/* ============================================================
   Masa Gold — Investor Portal
   Premium black / gold / white design system (custom, no Bootstrap look)
   ============================================================ */

:root {
    /* Brand */
    --gold-50: #fdf6e3;
    --gold-100: #fbeec2;
    --gold-300: #f0cd6a;
    --gold-400: #e6b94f;
    --gold-500: #d4a017;
    --gold-600: #b8860b;
    --gold-700: #8a6508;
    --gold-gradient: linear-gradient(135deg, #e6b94f 0%, #d4a017 50%, #b8860b 100%);
    --gold-gradient-soft: linear-gradient(135deg, #f6d97a 0%, #d4a017 100%);

    /* Dark sidebar */
    --sidebar-bg: linear-gradient(180deg, #11131a 0%, #0b0d12 60%, #07080c 100%);
    --sidebar-border: rgba(212, 160, 23, 0.14);

    /* Surfaces */
    --bg: #f6f5f1;
    --bg-warm: #faf9f6;
    --card: #ffffff;
    --card-border: #ece9e2;
    --card-shadow: 0 1px 3px rgba(20, 20, 25, 0.04), 0 8px 24px rgba(20, 20, 25, 0.05);
    --card-shadow-hover: 0 4px 12px rgba(20, 20, 25, 0.08), 0 16px 40px rgba(20, 20, 25, 0.08);

    /* Text */
    --text: #1a1c22;
    --text-soft: #5b6070;
    --text-muted: #9095a3;

    /* States */
    --green: #16a34a;
    --green-bg: #e7f6ec;
    --amber: #d97706;
    --amber-bg: #fdf2e2;
    --red: #dc2626;
    --blue: #2563eb;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 20px;

    --sidebar-w: 264px;
    --topbar-h: 76px;

    --font: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (max-width: 620px) {
    .investment-page-shell .plan-grid {
        gap: 14px;
    }
    .investment-page-shell .plan-card {
        border: 1px solid #ecd8aa;
        border-radius: 10px;
        padding: 0 10px 12px;
        box-shadow: 0 6px 18px rgba(120, 88, 20, 0.06);
        background: #fff;
    }
    .investment-page-shell .plan-head {
        margin: 0 -10px;
        padding: 14px 10px 8px;
        align-items: center;
        background:
            radial-gradient(circle at 8% 0%, rgba(230, 185, 79, 0.18), transparent 32%),
            linear-gradient(180deg, #fff9ea 0%, #fffdf8 84%, #fff 100%);
    }
    .investment-page-shell .plan-id {
        gap: 8px;
        min-width: 0;
    }
    .investment-page-shell .plan-badge {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        border-radius: 11px;
        font-size: 12px;
    }
    .investment-page-shell .plan-id h3 {
        font-size: 15px;
        line-height: 1.1;
    }
    .investment-page-shell .plan-card .pill {
        padding: 4px 8px;
        font-size: 10px;
        gap: 5px;
        white-space: nowrap;
    }
    .investment-page-shell .plan-return {
        margin: 0 -10px 10px;
        padding: 0 10px 10px;
        font-size: 12.5px;
        line-height: 1.25;
        border-bottom: 1px solid #f1eadb;
    }
    .investment-page-shell .plan-detail-grid,
    .investment-page-shell .plan-detail-grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        padding: 10px 0;
        border-top: 0;
        border-bottom: 1px solid #f4eee2;
    }
    .investment-page-shell .plan-detail-grid + .plan-detail-grid {
        border-top: 0;
    }
    .investment-page-shell .plan-detail-grid > div {
        padding: 0 10px;
        border-left: 1px solid #f1eadb;
    }
    .investment-page-shell .plan-detail-grid > div:first-child,
    .investment-page-shell .plan-detail-grid > div:nth-child(odd) {
        padding-left: 0;
        border-left: 0;
    }
    .investment-page-shell .plan-detail-grid:not(.plan-detail-grid--4) > div:nth-child(3) {
        grid-column: 1 / -1;
        margin-top: 10px;
        padding: 10px 0 0;
        border-left: 0;
        border-top: 1px solid #f1eadb;
    }
    .investment-page-shell .plan-detail-grid--4 {
        border-bottom: 1px solid #f1eadb;
    }
    .investment-page-shell .plan-detail-grid--4 > div {
        padding-bottom: 12px;
    }
    .investment-page-shell .plan-detail-grid--4 > div:nth-child(n + 3) {
        padding-top: 12px;
        padding-bottom: 0;
        border-top: 1px solid #f1eadb;
    }
    .investment-page-shell .plan-detail-grid--4 > div:nth-child(3) {
        padding-left: 0;
        border-left: 0;
    }
    .investment-page-shell .plan-detail-grid .pd-lbl {
        font-size: 10px;
        line-height: 1.15;
        margin-bottom: 5px;
    }
    .investment-page-shell .plan-detail-grid b {
        font-size: 13px;
        line-height: 1.15;
    }
    .investment-page-shell .plan-detail-grid b small {
        font-size: 9px;
    }
    .investment-page-shell .plan-perf {
        margin-top: 12px;
    }
    .investment-page-shell .plan-perf .pd-lbl {
        font-size: 12px;
        margin-bottom: 6px;
    }
    .investment-page-shell .plan-perf .chart-box--sm {
        height: 118px;
        border-top: 1px solid #f4eee2;
    }
    .investment-page-shell .plan-card > .btn:last-child {
        min-height: 36px;
        border-radius: 7px;
        font-size: 12px;
        margin-top: 12px !important;
    }
    .investment-page-shell .plan-progress {
        margin: 12px 0 8px;
        padding: 12px 10px;
        border: 1px solid #f2e6cf;
        border-radius: 9px;
        background: linear-gradient(180deg, #fffdf8 0%, #fff9ef 100%);
    }
    .investment-page-shell .plan-progress .pp-top {
        gap: 10px;
    }
    .investment-page-shell .plan-progress .pp-top b {
        font-size: 11px;
        white-space: nowrap;
    }
    .investment-page-shell .plan-progress .pp-sub {
        font-size: 12px;
        margin: 3px 0 8px;
        font-weight: 800;
    }
    .investment-page-shell .pp-bar {
        height: 9px;
        background: #eee7dc;
    }
    .investment-page-shell .pp-scale {
        font-size: 9.5px;
        margin-top: 5px;
    }
    .investment-page-shell .plan-mat-grid {
        gap: 8px;
        margin-top: 10px;
    }
    .investment-page-shell .plan-mat {
        border-radius: 9px;
        padding: 10px;
        gap: 9px;
        background: #fff8e9;
        border-color: #efd8a5;
    }
    .investment-page-shell .plan-mat .pm-ic {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
        border-radius: 8px;
    }
    .investment-page-shell .plan-mat .pm-ic svg {
        width: 15px;
        height: 15px;
    }
    .investment-page-shell .plan-mat .pd-lbl {
        font-size: 9.5px;
        line-height: 1.15;
    }
    .investment-page-shell .plan-mat b {
        font-size: 14px;
        line-height: 1.15;
    }
    .investment-page-shell .plan-mat b small,
    .investment-page-shell .plan-mat .pm-sub {
        font-size: 9.5px;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 15px;
    line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

/* ===================== App shell ===================== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===================== Sidebar (desktop) ===================== */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    color: #cdd1da;
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    z-index: 60;
    overflow-y: auto;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 22px;
}
.sidebar__logo .brand-mark { width: 132px; }

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}
.nav__item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    border-radius: 12px;
    color: #aab0bd;
    font-weight: 500;
    font-size: 14.5px;
    transition: background .18s, color .18s;
}
.nav__item svg { width: 19px; height: 19px; flex: 0 0 19px; }
.nav__item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav__item.active {
    background: var(--gold-gradient);
    color: #1a1205;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(212, 160, 23, 0.35);
}

/* Log Out in the slide-out menu (mobile only — desktop has it in the top bar). */
.sidebar-logout { display: none; margin-top: auto; padding-top: 12px; }
.nav__logout {
    width: 100%;
    background: transparent;
    border: none;
    border-top: 1px solid var(--sidebar-border);
    border-radius: 0 0 12px 12px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
    padding-top: 16px;
}
.nav__logout:hover { background: rgba(220, 38, 38, 0.14); color: #ff8a8a; }

.sidebar__promo {
    margin-top: auto;
    background: radial-gradient(120% 100% at 50% 0%, rgba(212,160,23,.18), rgba(212,160,23,0) 70%), #0e1016;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
}
.sidebar__promo img { width: 92px; margin: -42px auto 6px; display: block; }
.sidebar__promo h4 { margin: 6px 0 4px; color: #fff; font-size: 15px; }
.sidebar__promo p { margin: 0 0 14px; color: #9095a3; font-size: 12.5px; }

/* ===================== Main column ===================== */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ===================== Topbar (desktop) ===================== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}
.gold-ticker {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}
.gold-ticker .dot { font-size: 20px; }
.gold-ticker .pair { color: var(--text-soft); font-weight: 500; }
.gold-ticker .price { color: var(--text); }
.chip-up { color: var(--green); font-weight: 700; font-size: 13px; }
.chip-down { color: var(--red); font-weight: 700; font-size: 13px; }

.topbar__right { display: flex; align-items: center; gap: 20px; }
.icon-btn {
    position: relative;
    width: 42px; height: 42px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: #fff;
    display: grid; place-items: center;
    color: var(--text-soft);
    transition: background .15s;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn .badge {
    position: absolute; top: -6px; right: -6px;
    background: var(--gold-gradient);
    color: #1a1205;
    font-size: 11px; font-weight: 800;
    min-width: 19px; height: 19px;
    border-radius: 999px;
    display: grid; place-items: center;
    padding: 0 5px;
    border: 2px solid #fff;
}
/* Admin display-currency switcher (USDT / RM) */
.cur-switch {
    display: inline-flex;
    padding: 4px;
    gap: 3px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: #fff;
}
.cur-opt {
    min-width: 48px;
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .02em;
    text-align: center;
    color: var(--text-soft);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.cur-opt:hover { background: var(--bg); color: var(--text); }
.cur-opt.is-active {
    background: var(--gold-gradient);
    color: #1a1205;
    box-shadow: 0 2px 6px rgba(180,140,40,.25);
}

.user-pill {
    display: flex; align-items: center; gap: 11px;
    padding: 5px 10px 5px 5px;
    border-radius: 999px;
    transition: background .15s;
}
.user-pill:hover { background: var(--bg); }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--gold-gradient);
    display: grid; place-items: center;
    color: #1a1205; font-weight: 800; font-size: 15px;
    overflow: hidden;
}
.user-pill .who { line-height: 1.15; }
.user-pill .who b { font-size: 14px; }
.user-pill .who span { display: block; font-size: 11.5px; color: var(--gold-600); font-weight: 700; letter-spacing: .03em; }

/* ===================== Content ===================== */
.content { padding: 30px 32px 48px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { margin: 0; color: var(--text-soft); font-size: 14.5px; }

/* ===================== Grid helpers ===================== */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.span-2 { grid-column: span 2; }
.col-main { display: grid; gap: 20px; }

/* ===================== Card ===================== */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 22px;
    transition: box-shadow .2s, transform .2s;
}
.card--hover:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card__head h3 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card__sub { color: var(--text-muted); font-size: 12.5px; }

/* Summary stat card */
.stat {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.stat__icon {
    width: 48px; height: 48px; border-radius: 13px;
    display: grid; place-items: center;
    background: var(--gold-50);
    color: var(--gold-600);
    flex: 0 0 48px;
}
.stat__icon svg { width: 24px; height: 24px; }
.stat__label { color: var(--text-soft); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.stat__value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.stat__value small { font-size: 14px; font-weight: 600; color: var(--text-soft); }
.stat__meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.dashboard-stats { gap: 18px; }
.dashboard-stats .stat-card {
    min-height: 116px; padding: 18px 16px;
    border: 1.5px solid #e7e4dd; border-radius: 8px;
    box-shadow: 0 1px 2px rgba(20, 20, 25, 0.03);
}
.dashboard-stats .stat-card:hover { box-shadow: 0 2px 8px rgba(20, 20, 25, 0.05); transform: none; }
.dashboard-stats .stat { align-items: center; gap: 14px; height: 100%; }
.dashboard-stats .stat > div:last-child { min-width: 0; flex: 1; text-align: center; }
.dashboard-stats .stat__icon {
    width: 42px; height: 42px; flex: 0 0 42px; border-radius: 0;
    background: transparent; color: #d08a00;
}
.dashboard-stats .stat__icon svg,
.dashboard-stats .stat__icon img { width: 39px; height: 39px; display: block; object-fit: contain; }
.dashboard-stats .stat__icon--gold-bars img,
.dashboard-stats .stat__icon--growth img { width: 46px; height: 40px; }
.dashboard-stats .stat__icon--gold-bars .bar-top { fill: #f5b21a; }
.dashboard-stats .stat__icon--gold-bars .bar-side { fill: #d98a00; }
.dashboard-stats .stat__icon--gold-bars .bar-face { fill: #ffd45a; }
.dashboard-stats .stat__icon--wallet svg path,
.dashboard-stats .stat__icon--growth svg path { fill: #d89200; }
.dashboard-stats .stat__icon--wallet .wallet-pocket { fill: #f1b52f; }
.dashboard-stats .stat__icon--wallet .wallet-dot { fill: #fff7d7; }
.dashboard-stats .stat__label {
    color: #121722; font-size: 13px; font-weight: 800; margin-bottom: 8px;
    white-space: nowrap;
}
.dashboard-stats .stat__value {
    color: #05070c; font-size: 24px; font-weight: 800; letter-spacing: 0;
    line-height: 1.05; white-space: nowrap;
}
.dashboard-stats .stat__value small { color: #05070c; font-size: 15px; font-weight: 800; }
.dashboard-stats .stat__meta {
    color: #343b47; font-size: 12px; font-weight: 500; margin-top: 8px;
    white-space: nowrap;
}

/* Desktop summary cards: keep the same clean look as mobile (plain gold icon,
   no badge/background), just a touch larger to suit the wider card. */
@media (min-width: 1025px) {
    .dashboard-stats .stat__icon--gold-bars img,
    .dashboard-stats .stat__icon--growth img,
    .dashboard-stats .stat__icon--wallet img { width: 50px; height: 44px; }
}

/* ===================== Buttons ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; border-radius: 12px;
    padding: 12px 20px;
    font-weight: 700; font-size: 14px;
    transition: filter .15s, transform .1s, box-shadow .15s;
}
.btn-gold {
    background: var(--gold-gradient);
    color: #1a1205;
    box-shadow: 0 8px 20px rgba(212, 160, 23, 0.28);
}
.btn-gold:hover { filter: brightness(1.05); box-shadow: 0 10px 26px rgba(212, 160, 23, 0.38); }
.btn-gold:active { transform: translateY(1px); }
.btn-ghost {
    background: #fff;
    border: 1px solid var(--gold-300);
    color: var(--gold-700);
}
.btn-ghost:hover { background: var(--gold-50); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

/* ===================== Badges / pills ===================== */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill--green { background: var(--green-bg); color: var(--green); }
.pill--amber { background: var(--amber-bg); color: var(--amber); }
.pill--blue { background: #e6efff; color: var(--blue); }
.pill--red { background: #fdeaea; color: var(--red); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ===================== Tables ===================== */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
    text-align: left; color: var(--text-muted);
    font-weight: 600; font-size: 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid #f3f1ec; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .amt-pos { color: var(--green); font-weight: 700; }
.tbl .amt-neg { color: var(--text); font-weight: 700; }
.t-type { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.t-type .ti { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.ti--green { background: var(--green-bg); color: var(--green); }
.ti--gold { background: var(--gold-50); color: var(--gold-600); }
.ti--blue { background: #e6efff; color: var(--blue); }

/* ===================== Charts ===================== */
.chart-box { position: relative; height: 230px; }
.chart-box--sm { height: 180px; }
.chart-figure { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.profit-rate-card { overflow: hidden; }
.profit-rate-value { font-size: 32px; font-weight: 800; color: var(--gold-600); }
.profit-rate-label { color: var(--gold-700); font-weight: 700; }

/* ===================== Deposit page ===================== */
.tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
    background: #fff; border: 1.5px solid var(--card-border);
    border-radius: 8px; margin-bottom: 22px; overflow: hidden;
}
.tab {
    position: relative; min-height: 48px; text-align: center; padding: 12px 14px 13px; border-radius: 0;
    font-weight: 700; font-size: 13px; color: #3f4654;
    border: none; background: transparent; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: color .15s, background .15s;
}
.tab + .tab { border-left: 1.5px solid var(--card-border); }
.tab.active { background: #fff; color: #151821; box-shadow: none; }
.tab.active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0;
    height: 3px; background: var(--gold-500);
}
.tab-coin {
    width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
    color: #fff; font-size: 13px; font-weight: 800; line-height: 1;
}
.tab-coin--usdt { background: #22b573; }
.tab-bank-ic { color: #3f4654; flex: 0 0 auto; }
.redot-logo-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 24px;
}
.redot-logo-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #ef1b2d;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    font-family: Arial, sans-serif;
}
.redot-logo-mark--lg {
    width: 25px;
    height: 25px;
    font-size: 16px;
}
.redot-panel > .step-label,
.redot-panel > .net-grid,
.redot-panel > .wallet-block {
    display: none;
}
.redot-instruction {
    margin-top: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ececec;
}
.redot-instruction b {
    display: block;
    color: #161a22;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 3px;
}
.redot-instruction span {
    color: #676f7c;
    font-size: 12px;
}
.redot-pay-block {
    display: grid;
    gap: 10px;
    margin-top: 0;
}
.redot-id-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #fff;
}
.redot-id-card span {
    display: block;
    color: #252a33;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}
.redot-id-card strong {
    display: block;
    color: #10141d;
    font-size: 22px;
    line-height: 1.05;
    font-weight: 500;
    letter-spacing: .01em;
}
.redot-copy {
    width: 36px;
    height: 36px;
    border-left: 0;
    border-radius: 8px;
    color: #2c313a;
}
.redot-qr-card {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 12px 14px 10px;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #fff;
}
.redot-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #ef1b2d;
    font-size: 18px;
    font-weight: 900;
}
.redot-qr-help {
    color: #1c2028;
    font-size: 11px;
    font-weight: 700;
}
.redot-qr {
    width: 146px;
    height: 146px;
    border: 0;
    padding: 0;
}
.redot-qr-img {
    display: block;
    width: min(100%, 250px);
    height: auto;
    border-radius: 10px;
}
.redot-qr-caption {
    color: #2f3540;
    font-size: 11px;
}

.step-label { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; margin: 20px 0 11px; }
.step-num { width: 24px; height: 24px; border-radius: 8px; background: var(--gold-50); color: var(--gold-700); display: grid; place-items: center; font-size: 12.5px; font-weight: 800; }

.pkg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.pkg {
    border: 1.5px solid var(--card-border); border-radius: 10px; padding: 14px 38px 14px 16px;
    cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
    background: #fff; position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 12px;
    align-items: center;
    min-height: 86px;
}
.pkg:hover { border-color: var(--gold-300); }
.pkg.selected { border-color: var(--gold-500); background: var(--gold-50); box-shadow: 0 0 0 3px rgba(212,160,23,.12); }
.pkg .pkg-ic {
    width: 48px; height: 48px; border-radius: 13px; object-fit: cover; display: block;
    grid-column: 1; grid-row: 1 / 4; margin: 0; background: #fff; max-width: none;
    border: 1px solid var(--gold-100);
    box-shadow: 0 6px 14px rgba(120,88,20,.12), inset 0 1px 0 rgba(255,255,255,.6);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.pkg:hover .pkg-ic { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(120,88,20,.16); }
.pkg.selected .pkg-ic { border-color: var(--gold-300); box-shadow: 0 8px 18px rgba(212,160,23,.22); }
.pkg h4 { grid-column: 2; margin: 0 0 4px; font-size: 13px; line-height: 1.15; font-weight: 800; }
.pkg p { grid-column: 2; margin: 0 0 3px; font-size: 12px; color: var(--text-soft); line-height: 1.25; font-weight: 600; }
.pkg .pkg-return { grid-column: 2; margin: 0; font-size: 12px; line-height: 1.25; font-weight: 800; color: var(--gold-700); }
.pkg .check { position: absolute; top: 11px; right: 11px; width: 17px; height: 17px; border-radius: 50%; border: 0; display: none; place-items: center; color: #fff; }
.pkg.selected .check { background: var(--gold-500); border-color: var(--gold-500); }
.pkg.selected .check { display: grid; }

.net-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.net {
    border: 1.5px solid var(--card-border); border-radius: 12px; padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between; cursor: pointer;
    font-weight: 700; transition: border-color .15s, background .15s; background: #fff;
}
.net:hover { border-color: var(--gold-300); }
.net.selected { border-color: var(--gold-500); background: var(--gold-50); }
.net .net-l { display: flex; align-items: center; gap: 10px; }
.net .net-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; }
.net-ic--trc { background: #c4302b; }
.net-ic--erc { background: #627eea; }
.net .net-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--card-border); display:grid; place-items:center; color:#fff; }
.net.selected .net-check { background: var(--gold-500); border-color: var(--gold-500); }

.field { margin-bottom: 6px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text); margin: 18px 0 8px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.input, .select, textarea.input {
    width: 100%; padding: 13px 15px; border-radius: 12px;
    border: 1.5px solid var(--card-border); background: #fff;
    font-size: 14.5px; color: var(--text); font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--gold-400); box-shadow: 0 0 0 3px rgba(212,160,23,.15); }
.input-group { position: relative; }
.input-group .suffix { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 700; font-size: 13px; }

.wallet-block { display: grid; gap: 10px; }
.addr-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: center;
    border: 1.5px solid var(--card-border); border-radius: 8px;
    background: #fff; min-height: 42px; overflow: hidden;
}
.addr-box {
    display: flex; align-items: center; min-width: 0;
    background: transparent; border: 0; border-radius: 0;
    padding: 10px 13px; font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-size: 11px;
    font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy-btn {
    position: relative; width: 42px; height: 40px; border: 0; border-left: 1px solid transparent;
    background: #fff; display: grid; place-items: center; color: var(--text-soft); font-size: 0;
}
.copy-btn:hover { background: var(--bg); color: var(--gold-600); }
.copy-btn.copied svg { opacity: 0; }
.copy-btn.copied::after {
    content: "OK"; position: absolute; inset: 0; display: grid; place-items: center;
    color: var(--gold-700); font-size: 11px; font-weight: 800;
}
.qr-wrap { display: flex; justify-content: center; }
.qr {
    width: 120px; height: 120px; border-radius: 8px; border: 1.5px solid var(--card-border);
    background: #fff; display: grid; place-items: center; padding: 7px;
}
.qr svg { width: 100%; height: 100%; display: block; }

.dropzone {
    display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center;
    min-height: 74px; border: 1.5px dashed #ded8cc; border-radius: 7px; padding: 13px 16px;
    text-align: center; color: #111827; background: #fff;
    cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: #d49a00; background: #fffdfa; }
.dropzone__icon { justify-self: center; color: #20242c; }
.dropzone__copy { display: grid; justify-items: center; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.35; }
.dropzone b { color: #111827; font-weight: 800; }
.dropzone small { display: block; font-size: 11.5px; color: #7d8491; }
.dropzone .fname {
    grid-column: 1 / -1; justify-self: center; margin-top: 8px;
    font-weight: 700; color: var(--gold-700); font-size: 12.5px;
}
.deposit-submit {
    min-height: 44px; margin-top: 10px; border-radius: 7px;
    background: linear-gradient(180deg, #d99800 0%, #d28400 100%);
    color: #fff; box-shadow: none; font-size: 13px;
}
.deposit-submit:hover { filter: brightness(1.03); box-shadow: none; }

/* Summary aside */
.summary-hero { text-align: left; }
.summary-hero .big { font-size: 32px; font-weight: 800; }
.summary-hero .grams { color: var(--text-soft); font-weight: 600; }
.summary-row { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid #f3f1ec; }
.summary-row .si { width: 36px; height: 36px; border-radius: 10px; background: var(--gold-50); color: var(--gold-600); display: grid; place-items: center; flex: 0 0 36px; }
.summary-row b { font-size: 13.5px; }
.summary-row span { font-size: 12.5px; color: var(--text-soft); }
.return-box { margin-top: 8px; background: var(--gold-50); border: 1px solid var(--gold-100); border-radius: 14px; padding: 16px; }
.return-box .lbl { font-size: 12.5px; color: var(--amber); font-weight: 700; }
.return-box .val { font-size: 22px; font-weight: 800; color: var(--gold-700); }

.howto { display: flex; flex-direction: column; gap: 16px; }
.howto .ht { display: flex; gap: 13px; }
.howto .ht .n { width: 28px; height: 28px; border-radius: 9px; background: var(--gold-gradient); color: #1a1205; font-weight: 800; display: grid; place-items: center; flex: 0 0 28px; font-size: 13px; }
.howto .ht b { font-size: 13.5px; display: block; }
.howto .ht span { font-size: 12.5px; color: var(--text-soft); }

/* ===================== Affiliate page ===================== */
.affiliate-page-shell,
.affiliate-page-shell .main,
.affiliate-page-shell .content,
.investment-page-shell,
.investment-page-shell .main,
.investment-page-shell .content,
.dashboard-page-shell,
.dashboard-page-shell .main,
.dashboard-page-shell .content,
.deposit-page-shell,
.deposit-page-shell .main,
.deposit-page-shell .content,
.transactions-page-shell,
.transactions-page-shell .main,
.transactions-page-shell .content,
.withdrawal-page-shell,
.withdrawal-page-shell .main,
.withdrawal-page-shell .content {
    background: #fff;
}
.affiliate-hero-grid {
    align-items: start;
}
.ref-card {
    display: block;
    align-self: start;
    padding: 22px 26px;
    border: 1px solid #e8e1d7;
    border-radius: 14px;
    box-shadow: none;
    background: #fff;
}
.ref-card__inner {
    position: relative;
    width: 100%;
}
.ref-card__inner h3 {
    display: inline-block;
    margin: 0 8px 6px 0 !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 1.25;
    vertical-align: middle;
}
.ref-card__inner h3::after {
    content: "Your Referral Link";
    color: #9a5208;
    font-size: 18px;
    font-weight: 800;
}
.ref-title-copy {
    position: static;
    display: inline-grid;
    place-items: center;
    vertical-align: middle;
    width: 24px;
    height: 24px;
    margin: 0 0 6px;
    border-left: 0;
    border-radius: 6px;
    background: transparent;
    color: #1f2933;
}
.ref-title-copy:hover {
    background: #fff6e8;
    color: #9a5208;
}
.ref-title-copy.copied::after {
    font-size: 9px;
}
.ref-card__sub {
    margin: 0 0 14px;
    color: #525a67;
    font-size: 13px;
    font-weight: 600;
}
.ref-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    width: 100%;
}
.ref-link-input {
    width: 100%;
    height: 44px;
    border: 1.5px solid #f1c879;
    border-radius: 6px;
    background: #fffdf9;
    color: #1d232d;
    font-size: 14px;
    font-weight: 700;
    padding: 0 14px;
    box-shadow: 0 0 0 1px rgba(241, 200, 121, 0.12) inset;
}
.ref-link-input:focus {
    outline: none;
    border-color: #d99518;
    box-shadow: 0 0 0 3px rgba(217, 149, 24, 0.14);
}
.ref-row-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    min-width: 104px;
    padding: 0 18px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(185, 120, 0, 0.16);
}
.affiliate-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.downline-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.downline-summary-card .kpi-ic--mint { background: #e7f7ee; color: #1f9d57; }
.downline-summary-card .kpi-ic--blue { background: #e9f1fe; color: #2f6fe0; }
.affiliate-kpi-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 136px;
    padding: 20px 20px 18px;
    border: 1px solid #eadfcd;
    border-radius: 18px;
    background:
        linear-gradient(145deg, rgba(255, 250, 241, .92) 0%, rgba(255, 255, 255, .96) 48%, #fff 100%);
    box-shadow:
        0 18px 44px rgba(31, 24, 12, .08),
        0 3px 10px rgba(31, 24, 12, .04),
        inset 0 1px 0 rgba(255,255,255,.9);
}
.affiliate-kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, rgba(217, 149, 24, .95), rgba(255, 218, 115, .55), rgba(217, 149, 24, 0));
    opacity: .75;
}
.affiliate-kpi-card::after {
    content: "";
    position: absolute;
    right: -34px;
    top: -42px;
    width: 108px;
    height: 108px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(232, 174, 39, .18) 0%, rgba(232, 174, 39, 0) 68%);
    z-index: -1;
}
.affiliate-kpi-card .kpi-top {
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 12px;
}
.affiliate-kpi-card .kpi-label {
    color: #363d49;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -.01em;
}
.affiliate-kpi-card .kpi-ic {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 12px;
    background: linear-gradient(145deg, #fff7df 0%, #f8df9b 100%);
    color: #b97705;
    border: 1px solid #f4d78e;
    box-shadow: 0 8px 18px rgba(197, 139, 18, .15), inset 0 1px 0 rgba(255,255,255,.75);
}
.affiliate-kpi-card .kpi-ic svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.25;
}
.affiliate-kpi-card .kpi-val {
    color: #060910;
    font-size: clamp(24px, 1.9vw, 30px);
    line-height: 1;
    font-weight: 900;
    letter-spacing: -.035em;
    white-space: nowrap;
}
.affiliate-kpi-card .kpi-meta {
    margin-top: 11px;
    color: #8a93a1;
    font-size: 12.5px;
    line-height: 1.2;
    font-weight: 650;
}
.affiliate-network-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    align-items: start;
    gap: 20px;
}
.affiliate-side-stack {
    display: grid;
    gap: 16px;
    min-width: 0;
}
.commission-rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
    margin-bottom: 20px;
}
.affiliate-overview-stack {
    align-self: start;
}
.commission-banner {
    position: relative;
    min-height: 0;
    height: 170px;
    overflow: hidden;
    color: #fff;
    border: 1px solid rgba(255, 217, 120, 0.22);
    border-radius: 14px;
    padding: 22px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background:
        radial-gradient(circle at 82% 18%, rgba(219, 151, 24, 0.16), transparent 30%),
        radial-gradient(circle at 8% 12%, rgba(255, 255, 255, 0.08), transparent 26%),
        linear-gradient(135deg, #10141d 0%, #070a10 56%, #030509 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(212, 160, 23, 0.16),
        0 14px 34px rgba(4, 7, 12, 0.18);
}
.commission-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,.08), transparent 28%, rgba(212,160,23,.09));
    pointer-events: none;
}
.commission-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}
.commission-copy > div:first-child {
    color: #fff !important;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 800 !important;
    margin-bottom: 12px;
    text-shadow: 0 2px 12px rgba(0,0,0,.38);
}
.commission-banner .pct {
    color: #fff;
    font-size: clamp(52px, 5.2vw, 70px);
    line-height: .9;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 12px;
    text-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
}
.commission-banner small {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0,0,0,.34);
}
.commission-banner .net-ic-graphic {
    position: relative;
    z-index: 1;
    width: clamp(130px, 16vw, 185px);
    height: auto;
    flex: 0 0 auto;
}
.net-ic-graphic .person-node > circle {
    fill: rgba(5, 8, 13, 0.94);
    stroke: url(#affiliateGold);
    stroke-width: 5;
}
.net-ic-graphic .person-head,
.net-ic-graphic .person-body {
    fill: url(#affiliateGold);
}

.kpi { padding: 18px; }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi .kpi-label { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.kpi .kpi-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--gold-50); color: var(--gold-600); display: grid; place-items: center; }
.kpi .kpi-val { font-size: 22px; font-weight: 800; }
.kpi .kpi-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* downline tree */
.tree {
    --branch: #e3b24a;
    --branch-soft: rgba(227, 178, 74, 0.7);
    text-align: center;
    position: relative;
    padding: 0 12px 4px;
}
.tree .you {
    position: relative;
    z-index: 2;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 18px 8px;
    background: #fff;
}
.tree .you::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -31px;
    width: 2.5px;
    height: 31px;
    background: var(--branch);
    border-radius: 2px;
    transform: translateX(-50%);
}
.tree .node-av {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--gold-gradient);
    display: grid;
    place-items: center;
    color: #1a1205;
    font-weight: 800;
    box-shadow: 0 5px 14px rgba(212, 160, 23, 0.18);
}
.tree .you b { font-size: 13px; }
.tree-level {
    position: relative;
    margin-top: 30px;
    padding-top: 24px;
}
.tree-level::before {
    content: "";
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--branch) 10%, var(--branch) 90%, transparent);
}
.tree-level::after {
    content: "";
    position: absolute;
    top: -30px;
    left: 50%;
    width: 2px;
    height: 30px;
    background: var(--branch-soft);
    transform: translateX(-50%);
}
.tree-level .lvl-tag {
    position: absolute;
    left: 0;
    top: 2px;
    padding: 4px 8px;
    border: 1px solid #f5d88d;
    border-radius: 6px;
    background: #fffaf0;
    color: var(--gold-700);
    font-size: 11px;
    font-weight: 800;
}
.tree-row {
    position: relative;
    display: flex;
    gap: 18px;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 10px 2px;
    scrollbar-width: thin;
}
.tree-node {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 72px;
    padding-top: 14px;
}
.tree-node::before {
    content: "";
    position: absolute;
    top: -24px;
    left: 50%;
    width: 2px;
    height: 28px;
    background: linear-gradient(180deg, var(--branch), var(--branch-soft));
    transform: translateX(-50%);
}
.tree-node .tn-av {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2a2d36;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    border: 2px solid var(--gold-300);
    box-shadow: 0 6px 16px rgba(17, 19, 26, 0.08), 0 0 0 4px #fff;
}
.tree-node span { font-size: 11px; color: var(--text-soft); white-space: nowrap; }
.branch-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 480px;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.branch-tree {
    /* Level-label rail: top = offset + (level-1) * pitch (set per breakpoint). */
    --lbl-off: 16px;
    --lbl-pitch: 108px;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
    margin-top: 32px;
    padding: 30px 8px 4px 86px;
    width: max-content;
    min-width: 100%;
}
.branch-tree::before {
    content: "";
    position: absolute;
    top: 0;
    left: 142px;
    right: 24px;
    height: 2.5px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--branch) 4%, var(--branch) 96%, transparent);
}
.branch {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}
.branch--level1::before,
.branch-children > .branch::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -30px;
    width: 2.5px;
    height: 30px;
    background: var(--branch);
    border-radius: 2px;
    transform: translateX(-50%);
}
.branch-tree .tree-node::before {
    display: none;
}
.branch-children {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 18px;
    margin-top: 34px;
    padding-top: 30px;
}
.branch-children::before {
    content: "";
    position: absolute;
    top: 0;
    left: 36px;
    right: 36px;
    height: 2.5px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--branch) 6%, var(--branch) 94%, transparent);
}
.branch-children::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -34px;
    width: 2.5px;
    height: 34px;
    background: var(--branch);
    border-radius: 2px;
    transform: translateX(-50%);
}
.branch-children:has(> .branch:only-child)::before {
    display: none;
}
.branch-level-label {
    position: absolute;
    left: 0;
    top: calc(var(--lbl-off, 16px) + (var(--lvl, 1) - 1) * var(--lbl-pitch, 108px));
    padding: 4px 8px;
    border: 1px solid #f5d88d;
    border-radius: 6px;
    background: #fffaf0;
    color: var(--gold-700);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

@media (min-width: 1025px) {
    .affiliate-network-grid > .card:first-child {
        padding: 22px 24px 26px;
        border: 1px solid #eadfcd;
        border-radius: 18px;
        background:
            linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(255,253,248,.96) 100%);
        box-shadow:
            0 18px 44px rgba(31, 24, 12, .07),
            0 3px 10px rgba(31, 24, 12, .035);
    }
    .affiliate-network-grid > .card:first-child .card__head {
        margin-bottom: 18px;
    }
    .affiliate-network-grid > .card:first-child .card__head h3 {
        font-size: 17px;
        font-weight: 900;
        letter-spacing: -.02em;
    }
    .tree {
        min-height: 292px;
        padding: 10px 0 18px;
        overflow: hidden;
        border-radius: 16px;
        background:
            radial-gradient(circle at 50% 16%, rgba(225, 169, 46, .10), transparent 28%),
            linear-gradient(180deg, #fff 0%, #fffdf8 100%);
    }
    .tree-canvas {
        width: 100%;
    }
    .tree .you {
        padding: 0 22px 12px;
        background: transparent;
    }
    .tree .you::after {
        bottom: -42px;
        height: 42px;
        width: 3px;
        background: linear-gradient(180deg, #d69619, rgba(214, 150, 25, .6));
    }
    .tree .node-av {
        width: 54px;
        height: 54px;
        font-size: 16px;
        box-shadow:
            0 12px 28px rgba(212, 160, 23, .22),
            0 0 0 6px rgba(255, 246, 224, .95);
    }
    .tree .you b {
        font-size: 14px;
        letter-spacing: -.01em;
    }
    .branch-scroll {
        display: flex;
        justify-content: center;
        overflow-x: auto;
        overflow-y: visible;
        padding: 0 8px 8px;
    }
    .branch-tree {
        width: max-content;
        min-width: 0;
        margin: 44px auto 0;
        padding: 36px 42px 8px 84px;
        gap: 44px;
    }
    .branch-tree::before {
        top: 0;
        left: 120px;
        right: 48px;
        height: 3px;
        background: linear-gradient(90deg, transparent, #d69619 12%, #d69619 88%, transparent);
        box-shadow: 0 4px 14px rgba(214, 150, 25, .18);
    }
    .branch-tree:has(> .branch--level1:only-child)::before {
        display: none;
    }
    .branch--level1::before,
    .branch-children > .branch::before {
        top: -36px;
        height: 36px;
        width: 3px;
        background: linear-gradient(180deg, #d69619, rgba(214, 150, 25, .72));
    }
    .tree-node {
        min-width: 92px;
        gap: 8px;
        padding-top: 12px;
    }
    .tree-node .tn-av {
        width: 46px;
        height: 46px;
        font-size: 14px;
        border-color: #e1aa2f;
        box-shadow:
            0 10px 24px rgba(17, 19, 26, .10),
            0 0 0 5px #fff8e9;
    }
    .tree-node span {
        color: #3f4654;
        font-size: 12px;
        font-weight: 600;
    }
    .branch-children {
        gap: 26px;
        margin-top: 38px;
        padding-top: 34px;
    }
    .branch-children::before {
        left: 46px;
        right: 46px;
        height: 3px;
        background: linear-gradient(90deg, transparent, rgba(214, 150, 25, .76) 12%, rgba(214, 150, 25, .76) 88%, transparent);
    }
    .branch-children::after {
        top: -38px;
        height: 38px;
        width: 3px;
        background: linear-gradient(180deg, #d69619, rgba(214, 150, 25, .65));
    }
    .branch-level-label {
        left: 0;
        padding: 5px 10px;
        border-color: #f0c86b;
        border-radius: 8px;
        background: #fff8e8;
        box-shadow: 0 7px 16px rgba(186, 124, 6, .08);
        font-size: 11.5px;
    }
    .branch-level-label--one { top: 16px; }
    .branch-level-label--two { top: 142px; }
    .branch-level-label--three { top: 270px; }
}

@media (min-width: 621px) {
    .affiliate-network-grid > .card:first-child {
        overflow: visible;
    }
    .affiliate-network-grid > .card:first-child .card__head {
        padding-bottom: 14px;
        border-bottom: 1px solid #f2eadc;
    }
    .tree {
        width: min(100%, 760px);
        min-height: 300px;
        max-height: none !important;
        margin: 0 auto;
        padding: 18px 28px 24px;
        overflow: visible !important;
        border: 1px solid #efe2c9;
        border-radius: 18px;
        background:
            radial-gradient(circle at 50% 2%, rgba(231, 176, 48, .18), transparent 34%),
            linear-gradient(180deg, #fffdfa 0%, #fff8eb 100%);
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.8),
            0 18px 42px rgba(92, 65, 15, .08);
        scrollbar-width: none;
    }
    .tree::-webkit-scrollbar {
        display: none;
    }
    .tree-canvas {
        width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .tree .you {
        width: auto;
        min-width: 210px;
        padding: 0 18px 14px;
        border-radius: 16px;
        background: rgba(255,255,255,.64);
    }
    .tree .you::after {
        bottom: -42px;
        height: 42px;
        width: 3px;
        background: linear-gradient(180deg, #d99a18, #edc66f);
    }
    .branch-scroll {
        width: 100%;
        min-width: 0;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        overflow-x: auto;
        overflow-y: auto;
        max-height: 440px;
        padding: 0 0 6px;
    }
    .branch-tree {
        --lbl-off: 68px;
        --lbl-pitch: 126px;
        display: flex;
        justify-content: center;
        width: max-content;
        min-width: 0;
        max-width: 100%;
        margin: 42px auto 0;
        padding: 34px 34px 0;
        gap: 34px;
    }
    .branch-tree::before {
        left: 72px;
        right: 72px;
        top: 0;
        height: 3px;
        background: linear-gradient(90deg, transparent, #d99a18 18%, #d99a18 82%, transparent);
    }
    .branch-tree:has(> .branch--level1:only-child)::before {
        display: none;
    }
    .branch--level1::before,
    .branch-children > .branch::before {
        top: -34px;
        height: 34px;
        width: 3px;
        background: linear-gradient(180deg, #d99a18, #edc66f);
    }
    .tree-node {
        min-width: 104px;
        padding: 10px 10px 0;
        border-radius: 14px;
    }
    .tree-node .tn-av {
        width: 50px;
        height: 50px;
        border-width: 2px;
        background: linear-gradient(180deg, #171b25 0%, #10131b 100%);
        border-color: #e3ac32;
        box-shadow:
            0 12px 24px rgba(17, 19, 26, .14),
            0 0 0 6px #fff7e6;
    }
    .tree-node span {
        color: #1f2733;
        font-size: 12.5px;
        font-weight: 700;
    }
    .branch-level-label {
        left: auto;
        right: calc(100% + 12px);
        padding: 6px 11px;
        border-radius: 10px;
        background: #fff;
        border-color: #efc260;
        box-shadow: 0 12px 24px rgba(119, 76, 4, .10);
        color: #9a6202;
        font-size: 11.5px;
    }
    .branch-level-label--one {
        top: 68px;
    }
    .branch-level-label--two {
        top: 190px;
    }
    .branch-level-label--three {
        top: 320px;
    }
}

/* ===================== My Investment page ===================== */
.section-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.sec-ic {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 26px;
}
.sec-ic--plans {
    background: linear-gradient(145deg, #fff8e6, #f5c64f);
    border: 1px solid #efc45e;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 6px 14px rgba(212, 160, 23, .18);
}
.sec-ic--plans svg {
    width: 18px;
    height: 18px;
    overflow: visible;
}
.sec-ic-bg { fill: #fffaf0; stroke: #c98a05; stroke-width: 1.2; }
.sec-ic-fill { fill: rgba(212, 160, 23, .24); }
.sec-ic-line { fill: none; stroke: #9a6500; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sec-ic-dot { fill: #d4a017; stroke: #fff; stroke-width: .8; }

/* KPI cards */
.inv-kpis { gap: 18px; }
.inv-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-color: #eadfcb;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(20, 20, 25, 0.04), 0 1px 2px rgba(20, 20, 25, 0.04);
}
.inv-kpi-ic {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #fff8e7, #fff1c8);
    color: var(--gold-600);
}
.inv-kpi-ic svg { width: 24px; height: 24px; }
.inv-kpi-ic img { width: 42px; height: 34px; object-fit: contain; max-width: none; }
.inv-kpi-ic--earnings img { width: 38px; height: 30px; }
.inv-kpi-ic--plans svg {
    color: #d08b00;
    filter: drop-shadow(0 4px 8px rgba(208, 139, 0, .14));
}
.inv-kpi-body { min-width: 0; }
.inv-kpi-label { font-size: 12.5px; color: #3e4654; font-weight: 700; margin-bottom: 4px; }
.inv-kpi-val { font-size: 23px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; color: #080b12; }
.inv-kpi-meta { font-size: 11.5px; color: #7c8491; margin-top: 4px; }
.inv-kpi-meta.chip-up { font-size: 11.5px; }

/* Plan cards */
.plan-grid { align-items: stretch; }
.plan-card {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 0;
    border-color: #efd9aa;
    box-shadow: 0 10px 28px rgba(120, 88, 20, 0.06), 0 1px 2px rgba(20, 20, 25, 0.04);
}
.plan-card > .btn:last-child {
    margin-top: auto !important;
}
.plan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -24px 0;
    padding: 18px 24px 9px;
    background:
        radial-gradient(circle at 6% 8%, rgba(230, 185, 79, 0.16), transparent 30%),
        linear-gradient(180deg, #fffaf1 0%, #fffdfa 72%, #fff 100%);
    border-bottom: 0;
}
.plan-id { display: flex; align-items: center; gap: 12px; }
.plan-id h3 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.plan-badge {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 14px;
    flex: 0 0 34px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 8px 18px rgba(212, 160, 23, 0.16);
}
.plan-badge--a {
    background: linear-gradient(145deg, #fff2c5 0%, #f0bd3d 100%);
    color: #8a5900;
    border: 1px solid #efc55c;
}
.plan-badge--b {
    background: linear-gradient(145deg, #fff2c5 0%, #f0bd3d 100%);
    color: #8a5900;
    border: 1px solid #efc55c;
    font-size: 12px;
}
.plan-return {
    margin: 0 -24px 18px;
    padding: 0 24px 14px;
    background: linear-gradient(180deg, #fffdf8 0%, #fff 100%);
    border-bottom: 1px solid #f3f1ec;
    color: var(--gold-700);
    font-weight: 800;
    font-size: 13.5px;
}

.plan-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 13px 0;
    border-top: 1px solid #f3f1ec;
}
.plan-detail-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.plan-detail-grid > div {
    min-width: 0;
    padding: 0 16px;
    border-left: 1px solid #f3f1ec;
}
.plan-detail-grid > div:first-child {
    padding-left: 0;
    border-left: 0;
}
.plan-detail-grid .pd-lbl { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 5px; }
.plan-detail-grid b { font-size: 14.5px; font-weight: 800; }
.plan-detail-grid b small { font-size: 11px; font-weight: 600; color: var(--text-muted); }

.plan-perf { margin-top: 12px; }
.plan-perf .pd-lbl { color: #10141d; font-size: 13px; font-weight: 700; }
.plan-perf .chart-box--sm {
    height: 140px;
    border-top: 1px solid #f7f1e4;
    background: linear-gradient(180deg, rgba(255,250,240,.35), transparent);
}

/* Plan B Plus progress */
.plan-progress { margin: 14px 0 4px; }
.plan-progress .pp-top { display: flex; align-items: center; justify-content: space-between; }
.plan-progress .pp-top b { font-size: 13px; }
.plan-progress .pp-sub { font-size: 13px; color: var(--text); font-weight: 600; margin: 4px 0 8px; }
.pp-bar { height: 10px; border-radius: 999px; background: #eee8dd; overflow: hidden; }
.pp-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #d99000, #c58500); box-shadow: 0 2px 8px rgba(212, 160, 23, 0.3); transition: width .5s; }
.pp-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.plan-mat-grid { margin-top: 16px; gap: 12px; }
.plan-mat { display: flex; gap: 11px; align-items: flex-start; background: #fff8e9; border: 1px solid #f0d9a3; border-radius: 12px; padding: 14px; }
.plan-mat .pm-ic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: #fff; color: var(--gold-600); display: grid; place-items: center; box-shadow: inset 0 0 0 1px #f4e4bd; }
.plan-mat .pm-ic svg { width: 18px; height: 18px; }
.plan-mat .pd-lbl { display: block; font-size: 11.5px; color: var(--text-soft); margin-bottom: 3px; }
.plan-mat b { font-size: 18px; font-weight: 800; display: block; }
.plan-mat b small { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.plan-mat .pm-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.plan-card > .btn:last-child {
    min-height: 38px;
    border-radius: 8px;
    font-size: 13px;
}

/* ===================== Investment breakdown + activity (premium) ===================== */
.inv-bottom-grid { gap: 20px; }
.breakdown-card, .activity-card {
    display: flex;
    flex-direction: column;
    border-color: #ece3d2;
    box-shadow: 0 12px 30px rgba(120, 88, 20, 0.05), 0 1px 2px rgba(20, 20, 25, 0.04);
}

/* header icon badges */
.sec-ic--donut, .sec-ic--activity {
    width: 28px; height: 28px; border-radius: 8px; flex: 0 0 28px;
    display: inline-grid; place-items: center;
}
.sec-ic--donut {
    background: linear-gradient(145deg, #fff8e6, #f7d384);
    border: 1px solid #efc45e; color: #8a5d00;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 5px 12px rgba(212,160,23,.16);
}
.sec-ic--activity {
    background: linear-gradient(145deg, #eaf7ef, #c8ecd6);
    border: 1px solid #b6e3c6; color: #138a4e;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 5px 12px rgba(19,138,78,.14);
}
.sec-ic--donut svg, .sec-ic--activity svg { width: 16px; height: 16px; }
.card__head h3 { display: flex; align-items: center; gap: 9px; }

/* Donut + legend */
.breakdown-wrap { display: flex; align-items: center; gap: 24px; flex: 1; }
.donut-wrap { position: relative; width: 168px; height: 168px; flex: 0 0 168px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; pointer-events: none; gap: 2px; }
.donut-center .dc-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.donut-center .dc-val { font-size: 26px; font-weight: 900; letter-spacing: -0.03em; color: #0d1017; line-height: 1; }
.breakdown-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.bl-row {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 13px; border-radius: 12px;
    background: linear-gradient(135deg, #fcfbf8 0%, #f8f6f0 100%);
    border: 1px solid #efebe1;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.bl-row:hover { border-color: #e6dcc4; box-shadow: 0 6px 16px rgba(120,88,20,.07); transform: translateY(-1px); }
.bl-dot { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 12px; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.bl-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.bl-name { font-weight: 700; font-size: 13.5px; color: var(--text); line-height: 1.1; }
.bl-amt { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.bl-pct {
    font-size: 12.5px; font-weight: 800; color: #4a4030; white-space: nowrap;
    background: #fff; border: 1px solid #ece3d2; border-radius: 999px; padding: 3px 9px;
}

.breakdown-total {
    display: flex; align-items: center; gap: 10px;
    margin-top: 18px; padding: 13px 15px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gold-50) 0%, #fbf3da 100%);
    border: 1px solid var(--gold-100);
    font-size: 13px; color: var(--text-soft);
}
.breakdown-total .bt-ic {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
    display: grid; place-items: center;
    background: #fff; border: 1px solid var(--gold-100); color: var(--gold-600);
}
.breakdown-total .bt-ic svg { width: 16px; height: 16px; }
.breakdown-total .bt-lbl { font-weight: 600; }
.breakdown-total .bt-val { margin-left: auto; color: var(--gold-700); font-size: 15px; font-weight: 900; letter-spacing: -0.01em; }

/* Recent investment activity */
.inv-activity { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ia-row {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 10px; border-radius: 12px;
    transition: background .16s;
}
.ia-row:hover { background: #faf9f6; }
.ia-row + .ia-row { position: relative; }
.ia-row + .ia-row::before {
    content: ""; position: absolute; left: 10px; right: 10px; top: -2px;
    border-top: 1px solid #f1efe9;
}
.ia-row:hover::before, .ia-row:hover + .ia-row::before { border-color: transparent; }
.ia-ic {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
    display: grid; place-items: center;
}
.ia-ic svg { width: 18px; height: 18px; }
.ia-ic--green { background: var(--green-bg); color: var(--green); }
.ia-ic--blue { background: #e6efff; color: var(--blue); }
.ia-ic--gold { background: var(--gold-50); color: var(--gold-600); }
.ia-ic--red { background: #fdeaea; color: var(--red); }
.ia-body { min-width: 0; flex: 1; }
.ia-body b { font-size: 13.5px; display: block; color: var(--text); line-height: 1.2; }
.ia-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11.5px; color: var(--text-muted); }
.ia-plan { font-weight: 600; }
.ia-dot { color: #cfcabf; }
.ia-date { white-space: nowrap; color: var(--text-soft); }
.ia-amt {
    font-size: 14px; font-weight: 800; white-space: nowrap; text-align: right;
    letter-spacing: -0.01em; margin-left: auto;
}
.ia-amt.amt-pos { color: var(--green); }
.ia-amt.amt-neg { color: var(--red); }
.ia-amt.amt-neutral { color: var(--text-soft); font-weight: 700; font-size: 12.5px; }

@media (max-width: 1024px) {
    .plan-grid { grid-template-columns: 1fr; }
    .inv-bottom-grid { grid-template-columns: 1fr; }
    .inv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .breakdown-wrap { flex-direction: column; }
    .donut-wrap { margin: 2px auto 4px; }
    .breakdown-legend { width: 100%; }
}

@media (max-width: 620px) {
    .inv-bottom-grid { gap: 14px; }
    .breakdown-card, .activity-card { padding: 16px 14px; }
    .donut-wrap { width: 150px; height: 150px; flex-basis: 150px; }
    .donut-center .dc-val { font-size: 23px; }
    .bl-row { padding: 10px 12px; }
    .ia-row { gap: 11px; padding: 10px 6px; }
    .ia-ic { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
    .ia-body b { font-size: 13px; }
    .ia-meta { flex-wrap: wrap; gap: 2px 6px; font-size: 11px; }
    .ia-amt { font-size: 13.5px; }
}

@media (max-width: 620px) {
    .inv-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-bottom: 14px !important;
    }
    .inv-kpi {
        min-height: 112px;
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        align-items: start;
        gap: 8px;
        padding: 10px 8px;
        border-radius: 8px;
        box-shadow: none;
    }
    .inv-kpi-ic {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
        border-radius: 9px;
        background: transparent;
    }
    .inv-kpi-ic img {
        width: 34px;
        height: 28px;
    }
    .inv-kpi-ic--earnings img {
        width: 32px;
        height: 26px;
    }
    .inv-kpi-ic svg {
        width: 22px;
        height: 22px;
    }
    .inv-kpi-label {
        font-size: 9.5px;
        line-height: 1.15;
        color: #111722;
        margin-bottom: 7px;
    }
    .inv-kpi-val {
        font-size: 17px;
        line-height: 1;
        white-space: nowrap;
    }
    .inv-kpi-meta {
        font-size: 8.8px;
        line-height: 1.25;
        margin-top: 6px;
    }
    .inv-kpi-meta.chip-up {
        font-size: 8.8px;
        color: #16a34a;
    }
    .plan-detail-grid, .plan-detail-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .plan-mat-grid { grid-template-columns: 1fr; }
}

/* ===================== Dashboard referral card — premium mobile ===================== */
.dash-referral .ref-mobile { display: none; }
/* Grid items default to min-width:auto; the nested flex/grid here would otherwise
   balloon the card past the viewport and clip neighbouring cards. Let it shrink. */
.dash-referral { min-width: 0; }

.ref-mobile .rm-linklabel { font-size: 12px; color: var(--text-soft); font-weight: 600; margin-bottom: 8px; }
.ref-mobile .rm-linkrow {
    display: flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, var(--gold-50) 0%, #fbf3da 100%);
    border: 1px solid var(--gold-100); border-radius: 13px;
    padding: 7px 7px 7px 13px;
    overflow: hidden;
}
.ref-mobile .rm-linkic { color: var(--gold-600); display: grid; place-items: center; flex: 0 0 auto; }
.ref-mobile .rm-link {
    flex: 1; min-width: 0; font-size: 12.5px; color: var(--gold-700); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}
.ref-mobile .rm-copy {
    flex: 0 0 auto; width: 40px; height: 36px; border: none; border-radius: 10px;
    background: var(--gold-gradient); color: #1a1205; display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 5px 14px rgba(212, 160, 23, 0.32); transition: filter .15s, background .2s;
}
.ref-mobile .rm-copy:hover { filter: brightness(1.05); }
.ref-mobile .rm-copy.copied { background: var(--green); color: #fff; box-shadow: 0 5px 14px rgba(22, 163, 74, 0.3); }

/* minmax(0,1fr) lets the columns shrink below content width so the card never
   forces page-wide horizontal overflow on narrow phones. */
.ref-mobile .rm-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.ref-mobile .rm-stat {
    display: flex; align-items: center; gap: 10px; padding: 13px 12px;
    border-radius: 15px; border: 1px solid var(--gold-100);
    background: linear-gradient(135deg, #ffffff 0%, var(--gold-50) 100%);
    min-width: 0; overflow: hidden;
}
.ref-mobile .rm-stat-ic {
    width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px;
    background: var(--gold-50); color: var(--gold-600); display: grid; place-items: center;
}
.ref-mobile .rm-stat-ic svg { width: 19px; height: 19px; }
.ref-mobile .rm-stat-body { min-width: 0; }
.ref-mobile .rm-stat-val { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; }
.ref-mobile .rm-stat-lbl { font-size: 10.5px; color: var(--text-muted); font-weight: 600; margin-top: 4px; line-height: 1.2; }

/* dark premium tile (commission) */
.ref-mobile .rm-stat--dark {
    background: linear-gradient(135deg, #15171f 0%, #0b0d12 100%);
    border-color: var(--sidebar-border);
    box-shadow: 0 8px 22px rgba(11, 13, 18, 0.18);
}
.ref-mobile .rm-stat--dark .rm-stat-ic { background: rgba(212, 160, 23, 0.16); color: var(--gold-400); }
.ref-mobile .rm-stat--dark .rm-stat-val {
    background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ref-mobile .rm-stat--dark .rm-stat-lbl { color: #9095a3; }

.ref-mobile .rm-cta {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    margin-top: 13px; padding: 12px; border-radius: 12px;
    border: 1px solid var(--gold-300); color: var(--gold-700); background: #fff;
    font-size: 13px; font-weight: 700; transition: background .15s;
}
.ref-mobile .rm-cta:hover { background: var(--gold-50); }

/* ===================== Mobile downline tree (clean, indented) ===================== */
/* Hidden on desktop; the desktop ".tree" handles wide screens. */
.tree-mobile { display: none; }

.tree-mobile .mt-you {
    display: flex; align-items: center; gap: 11px;
    padding: 12px 14px; border-radius: 14px;
    background: linear-gradient(135deg, var(--gold-50) 0%, #fbf3da 100%);
    border: 1px solid var(--gold-100);
}
.tree-mobile .mt-rootbadge {
    margin-left: auto; flex: 0 0 auto;
    background: #fff; border: 1px solid var(--gold-100); color: var(--gold-700);
    font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}

/* Indented levels with a connector spine + elbows. */
.tree-mobile .mt-list,
.tree-mobile .mt-children { position: relative; margin-left: 18px; padding-left: 20px; }
.tree-mobile .mt-list { margin-top: 2px; }

.tree-mobile .mt-branch { position: relative; }
.tree-mobile .mt-branch::after {           /* vertical spine */
    content: ""; position: absolute; left: -20px; top: 0; bottom: 0; width: 2px; background: #e8ddc6;
}
.tree-mobile .mt-branch:last-child::after { bottom: auto; height: 33px; }
.tree-mobile .mt-branch::before {          /* horizontal elbow */
    content: ""; position: absolute; left: -20px; top: 33px; width: 16px; height: 2px; background: #e8ddc6;
}

.tree-mobile .mt-node {
    display: flex; align-items: center; gap: 11px;
    margin: 8px 0; padding: 9px 12px;
    border: 1px solid #efe7d6; border-radius: 12px; background: #fff;
    box-shadow: 0 1px 2px rgba(20, 20, 25, 0.03);
}
.tree-mobile .mt-av {
    width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%;
    background: #23262f; color: #fff; font-weight: 700; font-size: 12px;
    display: grid; place-items: center; border: 2px solid var(--gold-300);
}
.tree-mobile .mt-av--you { background: var(--gold-gradient); color: #1a1205; border: none; }
.tree-mobile .mt-body { min-width: 0; flex: 1; }
.tree-mobile .mt-name {
    font-size: 13.5px; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-mobile .mt-sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 11px; color: var(--text-muted); }
.tree-mobile .mt-sub--you { color: var(--gold-700); font-weight: 600; }
.tree-mobile .mt-lvl {
    background: var(--gold-50); color: var(--gold-700); font-weight: 800;
    font-size: 9.5px; letter-spacing: .03em; padding: 2px 7px; border-radius: 6px;
}
.tree-mobile .mt-status { display: inline-flex; align-items: center; gap: 5px; }
.tree-mobile .mt-dot { width: 6px; height: 6px; border-radius: 50%; }
.tree-mobile .mt-dot--on { background: var(--green); }
.tree-mobile .mt-dot--off { background: var(--text-muted); }

.affiliate-side-stack > .card,
.commission-rate-grid > .commission-card {
    border: 1px solid #eadfcd;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #fffdf8 100%);
    box-shadow: 0 14px 34px rgba(31, 24, 12, .06), 0 2px 8px rgba(31, 24, 12, .035);
}
.affiliate-side-stack .card__head,
.commission-rate-grid .card__head {
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #f3eadb;
}
.affiliate-side-stack .card__head h3,
.commission-rate-grid .card__head h3 {
    font-size: 15.5px;
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1.2;
}
.commission-card {
    position: relative;
    overflow: hidden;
}
.commission-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, #d99a18, rgba(217, 154, 24, 0));
}
.cstruct-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 13px;
    margin-bottom: 9px;
    border: 1px solid #f1e8d7;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(20, 20, 25, .025);
}
.cstruct-row:last-child { margin-bottom: 0; }
.cstruct-row b { font-size: 13.5px; }
.cstruct-row span { font-size: 11.5px; color: var(--text-muted); }
.cstruct-row .rate { font-size: 18px; font-weight: 900; color: var(--gold-600); white-space: nowrap; }
.cstruct-row .rate--blue { color: #2f6fe0; }

/* Earned footer row inside a commission card */
.cstruct-earned {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px; padding-top: 12px; border-top: 1px dashed #e8e2d4;
}
.cstruct-earned span { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.cstruct-earned b { font-size: 16px; font-weight: 800; color: var(--gold-700); }

/* Plan B card */
.plan-b-card .card__head h3 { background: none; }
.plan-b-strip {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 14px; margin-bottom: 12px; border-radius: 12px;
    background: linear-gradient(135deg, #eef4ff 0%, #f7faff 100%);
    border: 1px solid #dce8fb;
}
.pb-strip-label { font-size: 11.5px; color: #5a6b86; font-weight: 600; }
.pb-strip-val { font-size: 22px; font-weight: 800; color: #1f4fa3; letter-spacing: -0.02em; line-height: 1.1; }
.downline-overview-card .ovr-row {
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid #f1e8d7;
    border-radius: 12px;
    background: #fff;
}
.downline-overview-card .ovr-row:last-child { margin-bottom: 0; }

/* Commission earnings ledger */
.comm-split { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.comm-split-chip {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12.5px; color: var(--text-soft); font-weight: 600;
    padding: 6px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--bg, #fff);
}
.comm-split-chip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.comm-split-chip b { font-size: 14px; font-weight: 800; color: var(--text); }
.comm-split-chip small {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    background: rgba(0,0,0,.05); border-radius: 20px; padding: 1px 7px; margin-left: 2px;
}
.comm-split-chip--a i { background: var(--gold-500, #d99518); }
.comm-split-chip--a b { color: var(--gold-700, #a9710f); }
.comm-split-chip--b i { background: #2f6fe0; }
.comm-split-chip--b b { color: #1f4fa3; }

.comm-tabs { display: flex; gap: 8px; margin: 4px 0 14px; }
.comm-tab {
    font-size: 13px; font-weight: 700; color: var(--text-soft);
    padding: 7px 16px; border-radius: 999px; border: 1px solid var(--card-border);
    background: #fff; cursor: pointer; transition: all .15s ease;
}
.comm-tab:hover { border-color: var(--gold-400, #e8c97a); color: var(--text); }
.comm-tab.is-active { background: #131722; color: #fff; border-color: #131722; }

.comm-ledger td { vertical-align: middle; }
.comm-empty { text-align: center; padding: 34px 20px; }
.comm-empty p { font-weight: 700; margin: 0 0 4px; }
.comm-empty span { font-size: 13px; color: var(--text-muted); }

.ovr-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f3f1ec; }
.ovr-row:last-child { border-bottom: none; }
.ovr-row b { font-weight: 700; }

.rank-list { display: flex; flex-direction: column; }
.rank { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f3f1ec; }
.rank:last-child { border-bottom: none; }
.rank .num { width: 24px; height: 24px; border-radius: 8px; background: var(--gold-50); color: var(--gold-700); font-weight: 800; display: grid; place-items: center; font-size: 12px; }
.rank .nm { flex: 1; font-weight: 600; font-size: 13.5px; }
.rank .val { font-weight: 700; font-size: 13px; }
.member-av { width: 30px; height: 30px; border-radius: 50%; background: var(--gold-gradient); color: #1a1205; font-weight: 800; display: grid; place-items: center; font-size: 11px; }
.member-cell { display: flex; align-items: center; gap: 10px; }
.member-cell small { display: block; color: var(--text-muted); font-weight: 500; }

/* secure backing */
.secure-item { display: flex; gap: 13px; padding: 13px 0; border-bottom: 1px solid #f3f1ec; }
.secure-item:last-child { border-bottom: none; }
.secure-item .si-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--gold-50); color: var(--gold-600); display: grid; place-items: center; flex: 0 0 36px; }
.secure-item b { font-size: 13.5px; display: block; }
.secure-item span { font-size: 12.5px; color: var(--text-soft); }

/* ===================== Alerts (server-rendered fallback) ===================== */
.alert { border-radius: 12px; padding: 13px 16px; font-size: 13.5px; font-weight: 600; margin-bottom: 18px; display: flex; gap: 10px; align-items: center; }
.alert--ok { background: var(--green-bg); color: var(--green); }
.alert--err { background: #fdeaea; color: var(--red); }
.field-error { color: var(--red); font-size: 12px; margin-top: 5px; display: block; }
/* Once the toast enhancer is active, hide the inline fallback to avoid a flash. */
body.toasts-ready .alert { display: none !important; }

/* ===================== Toasts (modern notifications) ===================== */
.toast-stack {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 12px;
    width: 380px; max-width: calc(100vw - 32px);
    pointer-events: none;
}
.toast {
    pointer-events: auto; position: relative; overflow: hidden;
    display: flex; align-items: flex-start; gap: 13px;
    background: #fff; border: 1px solid var(--card-border); border-radius: 16px;
    padding: 15px 14px 15px 18px;
    box-shadow: 0 16px 40px rgba(20, 20, 25, 0.16), 0 2px 8px rgba(20, 20, 25, 0.06);
    transform: translateX(120%); opacity: 0;
    transition: transform .42s cubic-bezier(.16, 1, .3, 1), opacity .42s, margin .3s, max-height .3s;
    max-height: 240px;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; max-height: 0; margin-top: -12px; padding-top: 0; padding-bottom: 0; }
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: 5px 0 0 5px; }
.toast--ok::before { background: var(--green); }
.toast--err::before { background: var(--red); }
.toast--info::before { background: var(--gold-500); }

.toast__icon { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; }
.toast--ok .toast__icon { background: var(--green-bg); color: var(--green); }
.toast--err .toast__icon { background: #fdeaea; color: var(--red); }
.toast--info .toast__icon { background: var(--gold-50); color: var(--gold-600); }
.toast__icon svg { width: 19px; height: 19px; }

.toast__body { flex: 1; min-width: 0; padding-top: 1px; }
.toast__title { font-weight: 800; font-size: 13.5px; color: var(--text); margin-bottom: 2px; letter-spacing: -0.01em; }
.toast__msg { font-size: 12.5px; line-height: 1.45; color: var(--text-soft); word-break: break-word; }
.toast__msg b, .toast__msg strong { color: var(--text); }

.toast__close {
    flex: 0 0 auto; width: 26px; height: 26px; border: none; background: transparent;
    color: var(--text-muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center;
    transition: background .15s, color .15s;
}
.toast__close:hover { background: var(--bg); color: var(--text); }

.toast__progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left center; }
.toast--ok .toast__progress { background: var(--green); }
.toast--err .toast__progress { background: var(--red); }
.toast--info .toast__progress { background: var(--gold-500); }
.toast__progress.run { animation: toastProgress linear forwards; }
@keyframes toastProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 620px) {
    .toast-stack { top: 14px; right: 12px; left: 12px; width: auto; }
}

/* ===================== Transactions page ===================== */
.transactions-page { display: grid; gap: 18px; min-width: 0; }
.tx-head { margin-bottom: 0; }
.tx-head h1 { font-size: 32px; letter-spacing: -0.03em; }
.tx-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.tx-kpi {
    min-height: 126px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    border-radius: 8px;
    box-shadow: none;
    border-color: #e6e8ed;
    min-width: 0;
}
.tx-kpi-ic {
    width: 34px; height: 34px; border-radius: 11px;
    display: grid; place-items: center;
    color: #f59f00; background: #fff6df;
    flex: 0 0 34px;
}
.tx-kpi-ic svg { width: 21px; height: 21px; }
.tx-kpi-ic--gold img { width: 38px; height: 28px; max-width: none; }
.tx-kpi > div:last-child { min-width: 0; }
.tx-kpi-label { color: #141821; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.tx-kpi-value { color: #070a10; font-size: 24px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.tx-kpi-value span { color: var(--green); font-size: 12px; font-weight: 800; margin-left: 6px; }
.tx-kpi-meta { margin-top: 8px; color: #5d6470; font-size: 12px; font-weight: 500; }

.tx-main-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: 18px; min-width: 0; }
.tx-chart-card, .tx-insights, .tx-table-card {
    border-radius: 8px;
    border-color: #e6e8ed;
    box-shadow: none;
    min-width: 0;
}
.tx-chart { height: 240px; }
.tx-chart canvas { max-width: 100% !important; }
.tx-select, .tx-date, .tx-filter-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 36px; padding: 0 14px;
    border: 1px solid #e4e6eb; border-radius: 7px;
    background: #fff; color: #151922;
    font-size: 12.5px; font-weight: 700;
}
.tx-date svg, .tx-filter-btn svg { width: 16px; height: 16px; }
.tx-insight-row {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center; gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid #eef0f3;
    font-size: 13px;
}
.tx-insight-row b { font-size: 13px; font-weight: 800; color: #10141d; }
.tx-report-btn {
    width: 100%; min-height: 38px; margin-top: 12px;
    border: 1.5px solid #f1a10b; border-radius: 7px;
    color: #d98200; background: #fff; font-weight: 800;
}

.tx-type-ic {
    width: 22px; height: 22px; border-radius: 7px;
    display: inline-grid; place-items: center;
    font-size: 12px; font-weight: 900;
    vertical-align: middle;
}
.tx-type-ic--profit { color: #f59f00; background: #fff3d8; }
.tx-type-ic--deposit { color: #13a85a; background: #e8f8ef; }
.tx-type-ic--gold { color: #d98a00; background: #fff3d8; }
.tx-type-ic--withdraw { color: #ff8a00; background: #fff0df; }

.tx-filterbar {
    display: grid;
    grid-template-columns: auto minmax(340px, 1fr) minmax(260px, .8fr) auto;
    gap: 10px;
    align-items: center;
}
.tx-tabs { display: flex; gap: 3px; min-width: 0; }
.tx-tabs button, .tx-mobile-tabs button {
    border: 0; border-radius: 6px;
    background: #f5f6f8; color: #252b36;
    padding: 10px 15px;
    font-size: 12px; font-weight: 700;
    white-space: nowrap;
}
.tx-tabs button.active, .tx-mobile-tabs button.active {
    color: #fff; background: linear-gradient(180deg, #d79900, #c98300);
}
.tx-search {
    min-height: 38px; display: flex; align-items: center; gap: 8px;
    padding: 0 12px; border: 1px solid #e4e6eb; border-radius: 7px; background: #fff;
}
.tx-search svg { width: 16px; height: 16px; color: #6d7480; }
.tx-search input {
    min-width: 0; width: 100%; border: 0; outline: 0;
    font: inherit; font-size: 12.5px; color: var(--text);
}
.tx-mobile-tabs { display: none; }

.tx-table-card { padding: 0; overflow: hidden; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tx-table th {
    text-align: left;
    padding: 14px 18px;
    color: #4d5562;
    font-size: 12px;
    font-weight: 800;
    border-bottom: 1px solid #edf0f3;
}
.tx-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #edf0f3;
    color: #151922;
    white-space: nowrap;
}
.tx-table tr:last-child td { border-bottom: 0; }
.tx-amount { font-weight: 900; }
.tx-amount--pos { color: #13a85a; }
.tx-amount--neg { color: #f04438; }
.tx-status {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 25px; padding: 0 9px; border-radius: 6px;
    font-size: 11.5px; font-weight: 900;
}
.tx-status--credited, .tx-status--done { color: #159447; background: #dff8e8; }
.tx-status--pending { color: #b77900; background: #fff4d8; }
.tx-status--failed { color: #c92a2a; background: #fde8e8; }
.tx-mobile-list { display: none; }
.tx-pagination {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 18px;
    border-top: 1px solid #edf0f3;
    color: #2f3744; font-size: 12.5px;
}
.tx-pages { display: flex; align-items: center; gap: 8px; }
.tx-pages button {
    width: 34px; height: 34px; border-radius: 7px;
    border: 1px solid #e4e6eb; background: #fff; font-weight: 700;
}
.tx-pages button.active { border-color: #f1a10b; color: #d18400; }
.tx-pagination { justify-content: center; }
.tx-empty { text-align: center; color: var(--text-muted); font-size: 13.5px; padding: 30px 16px; }

/* ===================== Mobile header (hidden on desktop) ===================== */
.mobile-header, .scrim { display: none; }

/* ===================== Responsive ===================== */
@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }
    .affiliate-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .downline-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .affiliate-network-grid { grid-template-columns: 1fr; }
    .affiliate-side-stack,
    .commission-rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    :root { --sidebar-w: 0px; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform .28s ease;
        width: 280px; flex-basis: 280px;
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
    .main { margin-left: 0; }
    .topbar { display: none; }
    .sidebar-logout { display: block; }

    .mobile-header {
        display: flex; align-items: center; justify-content: space-between;
        height: 62px; padding: 0 16px;
        background: linear-gradient(180deg, #11131a, #0b0d12);
        position: sticky; top: 0; z-index: 45;
        border-bottom: 1px solid var(--sidebar-border);
    }
    .mobile-header .mh-logo { height: 30px; }
    .mobile-header .mh-btn { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #cdd1da; background: rgba(255,255,255,.06); border: none; position: relative; }
    .mobile-header .mh-left, .mobile-header .mh-right { display: flex; align-items: center; gap: 10px; }
    .mobile-account-menu { position: relative; margin: 0; padding: 0; display: grid; }
    .mobile-account-dropdown {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        min-width: 150px;
        padding: 7px;
        border: 1px solid rgba(212, 160, 23, .18);
        border-radius: 13px;
        background: #fff;
        box-shadow: 0 18px 40px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .08);
        opacity: 0;
        transform: translateY(-6px) scale(.98);
        pointer-events: none;
        transition: opacity .16s ease, transform .16s ease;
        z-index: 70;
    }
    .mobile-account-menu.open .mobile-account-dropdown {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
    .mobile-account-dropdown::before {
        content: "";
        position: absolute;
        top: -6px;
        right: 15px;
        width: 12px;
        height: 12px;
        background: #fff;
        border-left: 1px solid rgba(212, 160, 23, .18);
        border-top: 1px solid rgba(212, 160, 23, .18);
        transform: rotate(45deg);
    }
    .mobile-account-logout {
        position: relative;
        width: 100%;
        height: 40px;
        border: 0;
        border-radius: 10px;
        background: #fff8ea;
        color: #8a6508;
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 0 11px;
        font-size: 13px;
        font-weight: 800;
        text-align: left;
    }
    .mobile-account-logout svg { flex: 0 0 auto; }
    .mobile-header .badge {
        position: absolute; top: -4px; right: -4px; background: var(--gold-gradient);
        color: #1a1205; font-size: 10px; font-weight: 800; min-width: 17px; height: 17px;
        border-radius: 999px; display: grid; place-items: center; border: 2px solid #0b0d12;
    }

    .content { padding: 18px 15px calc(24px + env(safe-area-inset-bottom)); }
    .page-head h1 { font-size: 24px; }

    .grid-4, .grid-2 { grid-template-columns: 1fr 1fr; }
    .span-2 { grid-column: span 2; }

    /* Collapse grids whose columns are set via inline style (deposit form+summary,
       dashboard transaction row, affiliate KPI/3-col rows) — media queries on the
       utility classes can't beat an inline style, so override it here. */
    .grid[style*="grid-template-columns"] { grid-template-columns: 1fr 1fr !important; }

    .tx-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tx-main-grid { grid-template-columns: 1fr; }
    .tx-filterbar { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .grid-4, .grid-2, .grid-3, .pkg-grid { grid-template-columns: 1fr; }
    .affiliate-side-stack,
    .commission-rate-grid { grid-template-columns: 1fr; }
    .affiliate-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 14px;
    }
    .downline-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .affiliate-kpi-card {
        min-height: 112px;
        padding: 13px 12px;
        border-radius: 12px;
        box-shadow: none;
    }
    .affiliate-kpi-card .kpi-top { margin-bottom: 11px; gap: 8px; }
    .affiliate-kpi-card .kpi-label { font-size: 10.5px; line-height: 1.2; }
    .affiliate-kpi-card .kpi-ic {
        width: 27px;
        height: 27px;
        flex-basis: 27px;
        border-radius: 9px;
    }
    .affiliate-kpi-card .kpi-ic svg { width: 14px; height: 14px; }
    .affiliate-kpi-card .kpi-val { font-size: 19px; letter-spacing: -.02em; }
    .affiliate-kpi-card .kpi-meta { margin-top: 7px; font-size: 10px; }
    .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .span-2 { grid-column: span 1; }
    .pkg-grid { grid-template-columns: 1fr; }
    html, body, .main, .content { background: #fff; }
    html, body { max-width: 100%; overflow-x: hidden; }
    .content { padding: 13px 10px calc(82px + env(safe-area-inset-bottom)); }
    .page-head { margin-bottom: 12px; }
    .page-head h1 { font-size: 19px; margin-bottom: 3px; letter-spacing: 0; }
    .page-head p { max-width: 230px; font-size: 11.5px; line-height: 1.35; color: #20242c; }
    .card { border-radius: 8px; padding: 12px; box-shadow: 0 1px 2px rgba(20, 20, 25, 0.04); }
    .tabs {
        margin-bottom: 16px;
    }
    .tab {
        min-height: 46px;
        padding: 10px 7px 12px;
        gap: 5px;
        font-size: 11.5px;
        line-height: 1;
        white-space: nowrap;
    }
    .tab-bank-ic {
        width: 15px;
        height: 15px;
        flex-basis: 15px;
    }
    .redot-logo-img {
        width: 20px;
        height: 20px;
        flex-basis: 20px;
    }
    .ref-card {
        padding: 18px 16px;
        border-radius: 12px;
    }
    .ref-card__inner h3::after {
        font-size: 17px;
    }
    .ref-title-copy {
        position: static;
    }
    .ref-link-row {
        grid-template-columns: 1fr;
        gap: 9px;
    }
    .ref-row-copy {
        width: 100%;
    }
    .commission-banner {
        min-height: 148px;
        padding: 22px 18px;
        gap: 12px;
        border-radius: 12px;
    }
    .commission-copy > div:first-child {
        font-size: 18px;
        margin-bottom: 12px;
    }
    .commission-banner .pct {
        font-size: 46px;
        margin-bottom: 12px;
    }
    .commission-banner small {
        font-size: 13.5px;
        max-width: 180px;
    }
    .commission-banner .net-ic-graphic {
        width: 118px;
        margin-right: -10px;
    }
    /* Mobile: keep the full graphic tree, presented inside a pannable, fixed-height
       canvas (scroll left / right / down). Desktop geometry is preserved as-is. */
    .tree-mobile { display: none; }
    /* Let the grid column shrink below the tree's content width so .tree can clip + scroll. */
    .affiliate-network-grid > .card { min-width: 0; }
    .tree {
        display: block;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        max-height: 60vh;
        margin: 6px 0 0;
        padding: 12px 14px 16px;
        border: 1px solid #f0e6d4;
        border-radius: 14px;
        background-color: #fffdf8;
        background-image: radial-gradient(circle at 1px 1px, rgba(212,160,23,.10) 1.1px, transparent 1.3px);
        background-size: 18px 18px;
        box-shadow: inset 0 1px 3px rgba(120,88,20,.05);
        scrollbar-width: thin;
        scrollbar-color: var(--gold-300) transparent;
    }
    .tree::-webkit-scrollbar { width: 7px; height: 7px; }
    .tree::-webkit-scrollbar-thumb { background: var(--gold-300); border-radius: 99px; border: 1px solid #fffdf8; }
    .tree::-webkit-scrollbar-thumb:hover { background: var(--gold-400); }
    .tree::-webkit-scrollbar-track { background: transparent; }
    /* You + branches form one wide canvas that pans together. The canvas takes the
       FULL content width so the root centres over the same width as the branch row
       (not the narrow viewport) — that alignment is what makes the tree look neat. */
    .tree-canvas { width: max-content; min-width: 100%; }
    .tree .you { background: transparent; display: flex; width: 100%; }
    .branch-scroll { overflow: visible; padding-bottom: 0; width: max-content; min-width: 100%; }

    /* --- Neater tree geometry for mobile --- */
    .branch-tree { gap: 22px; padding: 30px 16px 10px 54px; }
    .branch-tree > .branch { gap: 0; }

    /* Level-1 connector bus: centred over the children; hidden for a lone child. */
    .branch-tree::before { left: 82px; right: 44px; }
    .branch-tree:has(> .branch--level1:only-child)::before { display: none; }

    /* Tighter child rows + level chips aligned to each depth band. */
    .branch-children { gap: 16px; margin-top: 30px; padding-top: 28px; }
    .branch-level-label { left: 2px; padding: 3px 8px; font-size: 10.5px; }
    .branch-level-label--one { top: 39px; }
    .branch-level-label--two { top: 172px; }
    .branch-level-label--three { top: 305px; }

    /* Premium mobile referral card. */
    .dash-referral .ref-desktop { display: none; }
    .dash-referral .ref-mobile { display: block; }
    .card__head { margin-bottom: 9px; }
    .card__head h3 { font-size: 11.5px; gap: 5px; }
    .pill { padding: 4px 9px; font-size: 10px; }
    .inv-kpis.grid,
    .inv-kpis.grid-4,
    .grid.inv-kpis[style*="grid-template-columns"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 9px !important;
        margin-bottom: 14px !important;
    }
    .inv-kpis .inv-kpi {
        min-height: 112px;
    }
    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 12px !important;
    }
    .dashboard-stats .stat-card {
        min-height: 82px;
        padding: 9px 7px;
        border-width: 1px;
        box-shadow: none;
    }
    .dashboard-stats .stat { gap: 6px; align-items: center; }
    .dashboard-stats .stat > div:last-child { text-align: center; }
    .dashboard-stats .stat__icon {
        width: 36px; height: 32px; flex-basis: 36px;
    }
    .dashboard-stats .stat__icon svg,
    .dashboard-stats .stat__icon img { width: 36px; height: 32px; max-width: none; }
    .dashboard-stats .stat__icon--gold-bars img,
    .dashboard-stats .stat__icon--growth img { width: 44px; height: 34px; }
    .dashboard-stats .stat__icon--wallet img { width: 42px; height: 32px; }
    .dashboard-stats .stat__label {
        font-size: 8.8px;
        line-height: 1.15;
        margin-bottom: 4px;
    }
    .dashboard-stats .stat__value {
        font-size: 17px;
        line-height: 1.05;
    }
    .dashboard-stats .stat__value small { font-size: 10px; }
    .dashboard-stats .stat__meta {
        font-size: 9.4px;
        line-height: 1.2;
        margin-top: 5px;
    }
    .dashboard-charts {
        gap: 12px;
        margin-bottom: 12px !important;
    }
    .dashboard-gold-price-card { display: none; }
    .chart-figure { font-size: 18px; letter-spacing: 0; }
    .chip-up { font-size: 10px; }
    .chart-box { height: 112px; margin-top: 3px; }
    .dashboard-info {
        gap: 12px;
        margin-bottom: 12px !important;
    }
    .profit-rate-card {
        background: linear-gradient(180deg, #fffdf8 0%, #fff9ee 100%);
        border-color: #f1d9a4;
    }
    .profit-rate-card > div:last-child { min-height: 58px; }
    .profit-rate-card > div:last-child > div:first-child {
        display: flex;
        align-items: flex-end;
        gap: 10px;
    }
    .profit-rate-value { font-size: 22px; line-height: 1.1; white-space: nowrap; }
    .profit-rate-label { font-size: 10px; line-height: 1.2; padding-bottom: 2px; }
    .profit-rate-card img { width: 78px !important; }
    .dashboard-lower { display: none; }
    .ref-link-row { max-width: 100%; }
    .stat__value { font-size: 21px; }

    .transactions-page {
        gap: 10px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    .transactions-page > *,
    .tx-kpi-grid,
    .tx-main-grid,
    .tx-chart-card,
    .tx-table-card,
    .tx-mobile-tabs,
    .tx-mobile-list,
    .tx-mobile-row {
        min-width: 0;
        max-width: 100%;
    }
    .transactions-page .tx-head h1 { font-size: 20px; }
    .transactions-page .tx-head p { max-width: 270px; color: #20242c; }
    .tx-kpi-grid {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
    .tx-kpi {
        min-height: 78px;
        padding: 10px 8px;
        gap: 6px;
        border-radius: 8px;
        overflow: hidden;
    }
    .tx-kpi-ic { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; }
    .tx-kpi-ic svg { width: 16px; height: 16px; }
    .tx-kpi-ic--gold img { width: 28px; height: 21px; max-width: none; }
    .tx-kpi-label {
        font-size: 8.7px;
        margin-bottom: 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .tx-kpi-value {
        font-size: 16px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .tx-kpi-value span { display: block; margin: 4px 0 0; font-size: 9px; }
    .tx-kpi-meta { margin-top: 4px; font-size: 9.5px; }

    .tx-main-grid { gap: 10px; }
    .tx-insights { display: none; }
    .tx-chart-card { padding: 12px; }
    .tx-chart-card .card__head { min-width: 0; gap: 8px; }
    .tx-chart-card .card__head > * { min-width: 0; }
    .tx-chart-card .card__head h3 { font-size: 11.5px; }
    .tx-chart-card .tx-select { min-height: 28px; padding: 0 9px; font-size: 10px; }
    .tx-chart { height: 128px; width: 100%; overflow: hidden; }
    .tx-chart canvas { width: 100% !important; max-width: 100% !important; }

    .tx-filterbar { display: none; }
    .tx-mobile-tabs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }
    .tx-mobile-tabs button {
        min-height: 36px;
        padding: 0 7px;
        font-size: 10.5px;
    }

    .tx-table-card {
        padding: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
    }
    .tx-table { display: none; }
    .tx-mobile-list {
        display: grid;
        gap: 8px;
    }
    .tx-mobile-row {
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr) auto;
        gap: 9px;
        align-items: center;
        padding: 11px 10px;
        border: 1px solid #e8ebef;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(20, 20, 25, 0.04);
    }
    .tx-mobile-main { min-width: 0; }
    .tx-mobile-main small {
        display: block;
        color: #6f7784;
        font-size: 8.8px;
        margin-bottom: 2px;
    }
    .tx-mobile-main b {
        display: block;
        color: #10141d;
        font-size: 12px;
        line-height: 1.2;
    }
    .tx-mobile-main em {
        display: block;
        color: #179a4f;
        font-size: 10px;
        font-style: normal;
        font-weight: 700;
        margin-top: 3px;
    }
    .tx-mobile-side {
        display: grid;
        justify-items: end;
        gap: 3px;
        min-width: 72px;
    }
    .tx-mobile-side b { font-size: 12px; color: #151922; }
    .tx-mobile-side .tx-amount { font-size: 11px; }
    .tx-mobile-side .tx-status { min-height: 20px; padding: 0 6px; font-size: 9px; border-radius: 5px; }
    .tx-type-ic { width: 24px; height: 24px; border-radius: 6px; }
    .tx-pagination { display: none; }
}

/* ===================== Investor Profile page ===================== */
.pf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.pf-edit-top { flex: 0 0 auto; white-space: nowrap; }

.pf-hero {
    display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap;
    margin-bottom: 20px; padding: 22px 24px;
    border-color: #ece3d2;
    box-shadow: 0 12px 30px rgba(120, 88, 20, 0.05), 0 1px 2px rgba(20, 20, 25, 0.04);
}
.pf-hero-id { display: flex; align-items: center; gap: 18px; min-width: 0; }
.pf-av {
    width: 78px; height: 78px; flex: 0 0 78px; border-radius: 50%;
    background: var(--gold-gradient); color: #1a1205; font-weight: 800; font-size: 26px;
    display: grid; place-items: center; box-shadow: 0 8px 20px rgba(212, 160, 23, 0.22);
}
.pf-id-body { min-width: 0; }
.pf-name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: #0d1017; }
.pf-idline { font-size: 13px; color: var(--text-soft); margin: 3px 0 9px; }
.pf-idline b { color: var(--text); }
.pf-contact { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.pf-contact svg { width: 15px; height: 15px; color: var(--gold-600); flex: 0 0 15px; }

.pf-hero-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 34px; }
.pf-meta-item { display: flex; align-items: center; gap: 11px; }
.pf-meta-ic { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; display: grid; place-items: center; }
.pf-meta-ic svg { width: 19px; height: 19px; }
.pf-meta-ic--gold { background: var(--gold-50); color: var(--gold-600); }
.pf-meta-ic--green { background: var(--green-bg); color: var(--green); }
.pf-meta-ic--blue { background: #e8f0ff; color: #2563eb; }
.pf-meta-lbl { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.pf-meta-val { font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; margin-top: 1px; }
.pf-tier { color: var(--gold-700); }

.pf-grid { gap: 20px; margin-bottom: 20px; }
.pf-card { border-color: #ece3d2; box-shadow: 0 12px 30px rgba(120, 88, 20, 0.05), 0 1px 2px rgba(20, 20, 25, 0.04); }
.pf-card .card__head h3 { display: flex; align-items: center; gap: 9px; }

/* Accordion head — a section header on desktop, a tappable row on mobile. */
.pf-acc-head {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: none; border: 0; padding: 0; margin: 0 0 16px;
    font-family: inherit; text-align: left; color: var(--text); cursor: default;
}
.pf-acc-titles { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pf-acc-title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.pf-acc-sum { display: none; }
.pf-acc-chev { display: none; }
.pf-ok { color: var(--green); font-weight: 800; }

/* Mobile-only chrome — hidden on desktop. */
.pf-vip, .pf-hero-chips, .pf-edit-mobile, .pf-acc--mobile, .pf-copy { display: none; }
.pf-h-ic {
    width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; display: inline-grid; place-items: center;
    background: linear-gradient(145deg, #fff8e6, #f7d384); border: 1px solid #efc45e; color: #8a5d00;
}
.pf-h-ic svg { width: 16px; height: 16px; }
.pf-soon { font-size: 11px; font-weight: 700; color: var(--text-muted); background: #f3f1ec; border-radius: 999px; padding: 4px 10px; }

.pf-field { margin-bottom: 14px; }
.pf-field label { display: block; font-size: 13px; font-weight: 600; color: #2a2d36; margin-bottom: 7px; }
.pf-readonly { background: #f4f5f7 !important; color: #7c8491 !important; cursor: not-allowed; }
.pf-hint { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

.pf-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f3f1ec; font-size: 13.5px; }
.pf-row span { color: var(--text-soft); }
.pf-row b { color: var(--text); font-weight: 700; }
.pf-note { font-size: 12px; color: var(--text-muted); margin: 14px 0 0; line-height: 1.5; }

.pf-prefs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; align-items: start; }
.pf-rate-card {
    padding: 16px; border-radius: 13px;
    background: linear-gradient(135deg, var(--gold-50) 0%, #fbf3da 100%);
    border: 1px solid var(--gold-100);
}
.pf-rate-top { display: flex; align-items: center; justify-content: space-between; }
.pf-rate-lbl { font-size: 12px; font-weight: 700; color: var(--gold-700); text-transform: uppercase; letter-spacing: .04em; }
.pf-rate-badge { font-size: 11px; font-weight: 800; color: var(--text-muted); }
.pf-rate-badge.is-live { color: var(--green); }
.pf-rate-main { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: #0d1017; margin-top: 10px; }
.pf-rate-main b { color: var(--gold-700); }
.pf-rate-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 6px; }
.pf-rate-sub b { color: var(--text); }
.pf-rate-usdt { color: var(--text-muted); }

.pf-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 13px; color: var(--text-soft); }
.pf-switch { width: 40px; height: 23px; border-radius: 999px; background: #d6d3cc; position: relative; flex: 0 0 40px; transition: background .18s; }
.pf-switch.is-on { background: var(--gold-gradient); }
.pf-switch-knob { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.22); transition: transform .18s; }
.pf-switch.is-on .pf-switch-knob { transform: translateX(17px); }

.pf-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 14px; margin-top: 4px; }

@media (max-width: 900px) {
    .pf-hero { flex-direction: column; align-items: stretch; }
    .pf-hero-meta { grid-template-columns: 1fr 1fr; gap: 14px 18px; }
    .pf-grid { grid-template-columns: 1fr; }
    .pf-prefs-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .pf-head { flex-direction: column; }
    .pf-hero-id { gap: 14px; }
    .pf-av { width: 64px; height: 64px; flex-basis: 64px; font-size: 22px; }
    .pf-name { font-size: 19px; }
    .pf-hero-meta { grid-template-columns: 1fr; }
    .pf-actions { grid-template-columns: 1fr; }
}

/* ---- Mobile: compact identity card + collapsible list (matches mockup) ---- */
@media (max-width: 700px) {
    .pf-edit-top { display: none; }
    .pf-edit-mobile { display: inline-flex; width: 100%; justify-content: center; margin: 0 0 16px; }

    .pf-hero { padding: 18px 16px; }
    .pf-hero .pf-contact { display: none; }
    .pf-hero-meta { display: none; }
    .pf-idline { display: flex; align-items: center; gap: 6px; }
    .pf-copy { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; background: transparent; color: var(--gold-600); cursor: pointer; }
    .pf-copy svg { width: 14px; height: 14px; }
    .pf-vip {
        display: inline-flex; align-items: center; gap: 5px; width: fit-content; margin-top: 9px;
        padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
        background: var(--gold-50); color: var(--gold-700); border: 1px solid var(--gold-100);
    }
    .pf-hero-chips { display: flex; gap: 10px; justify-content: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f1efe9; }

    .pf-grid { gap: 12px; margin-bottom: 12px; }
    .pf-acc--mobile { display: block; margin-bottom: 12px; }
    .pf-card.pf-acc { padding: 0; margin-bottom: 12px; overflow: hidden; }
    .pf-acc-head { margin: 0; padding: 15px 16px; cursor: pointer; }
    .pf-acc-head .pf-h-ic { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
    .pf-acc-head .pf-h-ic svg { width: 18px; height: 18px; }
    .pf-acc-title { font-size: 14.5px; }
    .pf-acc-sum { display: block; font-size: 12px; color: var(--text-soft); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pf-acc-chev { display: block; width: 18px; height: 18px; flex: 0 0 18px; color: var(--text-muted); transition: transform .2s; }
    .pf-acc.open > .pf-acc-head .pf-acc-chev { transform: rotate(90deg); }
    .pf-acc-body { display: none; padding: 2px 16px 16px; }
    .pf-acc.open > .pf-acc-body { display: block; }
    .pf-soon { display: none; }
    .cp-badge { display: none; }
    .cp-card { margin-top: 12px; }
    .cp-card .pf-acc-body { padding-top: 12px; }

    .pf-prefs-grid { grid-template-columns: 1fr; gap: 14px; }
    .pf-actions { grid-template-columns: 1fr; }
}

/* ===================== Withdrawal page ===================== */
.wd-hint { font-size: 12.5px; color: var(--text-muted); margin: -4px 0 12px; }

.wd-opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wd-opt {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 14px; border: 1.5px solid var(--card-border); border-radius: 14px;
    cursor: pointer; background: #fff; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.wd-opt:hover { border-color: var(--gold-400, #e8c97a); }
.wd-opt.selected { border-color: var(--gold-500, #d99518); background: var(--gold-50, #fdf7ec); box-shadow: 0 4px 14px rgba(217,149,24,.10); }
.wd-opt-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.wd-opt-ic--a { background: #fdf1da; color: #b9810f; }
.wd-opt-ic--b { background: #e9f1fe; color: #2f6fe0; }
.wd-opt-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.wd-opt-body b { font-size: 13.5px; }
.wd-opt-amt { font-size: 16px; font-weight: 800; color: var(--text); }
.wd-opt-body small { font-size: 11px; color: var(--text-muted); }
.wd-opt-check {
    position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--gold-500, #d99518); color: #fff; display: none; place-items: center;
}
.wd-opt.selected .wd-opt-check { display: grid; }

.wd-avail {
    display: flex; align-items: flex-end; justify-content: space-between;
    padding: 14px 16px; margin: 4px 0 18px; border-radius: 14px;
    background: linear-gradient(135deg, #fbf6ec 0%, #fff 100%); border: 1px solid #efe6d2;
}
.wd-avail span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.wd-avail-val { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.wd-avail-gold { font-size: 12.5px; color: var(--gold-700, #a9710f); font-weight: 700; }

.wd-method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.wd-method {
    position: relative; display: flex; align-items: center; gap: 9px;
    padding: 13px 14px; border: 1.5px solid var(--card-border); border-radius: 12px;
    cursor: pointer; font-weight: 700; font-size: 13.5px; background: #fff; transition: all .15s ease;
}
.wd-method:hover { border-color: var(--gold-400, #e8c97a); }
.wd-method.selected { border-color: var(--gold-500, #d99518); background: var(--gold-50, #fdf7ec); }
.wd-method-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; }
.wd-method-ic--usdt { background: #26a17b; }
.wd-method-bank { color: var(--gold-600, #c5901c); }
.wd-method-check { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 50%; background: var(--gold-500, #d99518); color: #fff; display: none; place-items: center; }
.wd-method.selected .wd-method-check { display: grid; }

.suffix--ic { pointer-events: none; }
.wd-amount-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; font-size: 12px; color: var(--text-muted); }
.wd-max { background: none; border: none; color: var(--gold-700, #a9710f); font-weight: 700; font-size: 12px; cursor: pointer; padding: 0; }
.wd-max:hover { text-decoration: underline; }
.wd-notes { resize: vertical; min-height: 52px; font-family: inherit; }
.wd-notes-count { text-align: right; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.wd-submit { margin-top: 20px; }

/* Summary card */
.wd-summary .wd-sum-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f3f1ec; font-size: 13.5px; }
.wd-summary .wd-sum-row span { color: var(--text-soft); }
.wd-summary .wd-sum-row b { font-weight: 700; }
.wd-sum-fee { color: var(--red, #d2453b) !important; }
.wd-sum-total {
    display: flex; align-items: center; justify-content: space-between;
    margin: 14px 0; padding: 16px; border-radius: 14px;
    background: linear-gradient(135deg, #fff6e7 0%, #fdeccb 100%); border: 1px solid #f1d9a6;
}
.wd-sum-total span { font-size: 13.5px; font-weight: 700; color: var(--text); }
.wd-sum-total b { font-size: 22px; font-weight: 800; color: #d98a12; letter-spacing: -0.02em; }
.wd-sum-time { color: var(--text-soft) !important; }

.wd-notice {
    position: relative; display: flex; gap: 12px; align-items: flex-start;
    margin-top: 16px; padding: 16px; border-radius: 14px; overflow: hidden;
    background: linear-gradient(135deg, #fdf6e8 0%, #fbeece 100%); border: 1px solid #f0ddb4;
}
.wd-notice-ic { color: #c5901c; flex-shrink: 0; }
.wd-notice-body b { font-size: 13.5px; display: block; }
.wd-notice-body p { margin: 3px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.wd-notice-body span { font-size: 12px; color: var(--text-muted); }
.wd-notice-img { position: absolute; right: 10px; bottom: 8px; width: 64px; opacity: .9; }

@media (max-width: 980px) {
    .wd-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 560px) {
    .wd-opt-grid, .wd-method-grid { grid-template-columns: 1fr; }
}

/* ===================== Change Password card ===================== */
.cp-card { margin-top: 20px; }
/* "Secured" pill sits in the accordion head on desktop; hidden on mobile for a clean tap row. */
.cp-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--green, #1f9d57); background: var(--green-bg, #e7f7ee); padding: 5px 10px; border-radius: 999px; flex-shrink: 0; }

.cp-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 26px; align-items: start; }
.cp-field { margin-bottom: 16px; }
.cp-field > label { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.cp-input { position: relative; }
.cp-input .input { padding-right: 44px; }
.cp-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: none; background: none; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; border-radius: 8px; }
.cp-eye:hover { color: var(--gold-600, #c5901c); background: var(--bg); }
.cp-eye svg { width: 19px; height: 19px; }

/* Strength meter */
.cp-strength { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.cp-strength-track { flex: 1; height: 6px; border-radius: 6px; background: #ececec; overflow: hidden; }
.cp-strength-track i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width .25s ease, background .25s ease; }
.cp-strength-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); min-width: 78px; text-align: right; }
.cp-strength[data-level="1"] .cp-strength-track i { width: 28%; background: #e0564b; }
.cp-strength[data-level="2"] .cp-strength-track i { width: 52%; background: #e8a83b; }
.cp-strength[data-level="3"] .cp-strength-track i { width: 76%; background: #4d97e6; }
.cp-strength[data-level="4"] .cp-strength-track i { width: 100%; background: #28a05a; }
.cp-strength[data-level="1"] .cp-strength-label { color: #e0564b; }
.cp-strength[data-level="2"] .cp-strength-label { color: #c98718; }
.cp-strength[data-level="3"] .cp-strength-label { color: #2f6fe0; }
.cp-strength[data-level="4"] .cp-strength-label { color: #1f9d57; }

.cp-match { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700; }
.cp-match.is-ok { color: var(--green, #1f9d57); }
.cp-match.is-bad { color: var(--red, #d2453b); }

/* Requirements checklist */
.cp-reqs { background: var(--bg-warm, #faf9f6); border: 1px solid var(--card-border); border-radius: 14px; padding: 18px; }
.cp-reqs-title { font-size: 12.5px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.cp-req-list { list-style: none; margin: 0; padding: 0; }
.cp-req-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); padding: 6px 0; transition: color .15s ease; }
.cp-tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #d8d4cb; display: grid; place-items: center; flex-shrink: 0; position: relative; transition: all .15s ease; }
.cp-tick::after { content: ""; width: 8px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(0,-1px); opacity: 0; }
.cp-req-list li.ok { color: var(--text); font-weight: 600; }
.cp-req-list li.ok .cp-tick { background: var(--green, #28a05a); border-color: var(--green, #28a05a); }
.cp-req-list li.ok .cp-tick::after { opacity: 1; }

.cp-actions { display: flex; justify-content: flex-end; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--card-border); }
.cp-submit { min-width: 200px; }

@media (max-width: 760px) {
    .cp-grid { grid-template-columns: 1fr; gap: 18px; }
    .cp-actions { justify-content: stretch; }
    .cp-submit { width: 100%; }
}


/* ===================== Downline org-chart (image-3 style, any branch count) ===================== */
.dtree-wrap {
    --branch: #e8c984;          /* connector colour */
    --node-w: 82px;
    --node-h: 72px;
    --you-w: 172px;
    --you-h: 74px;
    --gap: 32px;
    --gap-half: 16px;
    --pad-top: 22px;
    position: relative;
    overflow: auto;
    max-height: min(72vh, 620px);
    min-height: min(520px, calc(var(--pad-top) + var(--you-h) + (var(--tree-depth, 3) * (var(--node-h) + var(--gap))) + 34px));
    padding: 18px 24px 26px 92px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 50% 0%, rgba(231, 176, 48, .10), transparent 42%),
        linear-gradient(180deg, #fffefa 0%, #fffaf1 100%);
    border: 1px solid #efe2c9;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
    scrollbar-width: thin;
    scrollbar-color: #e2b65a transparent;
}
.dtree-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.dtree-wrap::-webkit-scrollbar-thumb {
    background: #e2b65a;
    border: 2px solid #fffaf1;
    border-radius: 999px;
}

/* Left "Level N" rail — aligned to each row via the fixed pitch. */
.dtree-rail { position: absolute; left: 20px; top: 0; bottom: 0; width: 58px; pointer-events: none; }
.dtree-level-label {
    position: absolute; left: 0;
    top: calc(var(--pad-top) + var(--you-h) + var(--gap) + var(--node-h) / 2 + (var(--lvl) - 1) * (var(--node-h) + var(--gap)));
    transform: translateY(-50%);
    font-size: 11px; font-weight: 850; color: var(--gold-700, #8a6508);
    background: #fffaf0; border: 1px solid #f0c56a; border-radius: 8px; padding: 5px 10px; white-space: nowrap;
    box-shadow: 0 8px 18px rgba(150, 110, 20, .10);
}

/* Tree */
.dtree {
    width: max-content;
    min-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}
.dtree ul { display: flex; justify-content: center; position: relative; padding-top: var(--gap-half, 22px); margin: 0; list-style: none; }
.dtree > ul { padding-top: 4px; }
.dtree li {
    list-style: none;
    position: relative;
    padding: var(--gap-half, 22px) clamp(10px, 1.8vw, 24px) 0;
    text-align: center;
    flex: 0 0 auto;
}

/* Connectors — classic auto-centering org-chart lines (rounded elbows). */
.dtree li::before,
.dtree li::after {
    content: ""; position: absolute; top: 0; width: 50%; height: var(--gap-half, 22px);
    border-top: 2px solid var(--branch);
}
.dtree li::before { right: 50%; }
.dtree li::after  { left: 50%; border-left: 2px solid var(--branch); }
.dtree li:first-child::before,
.dtree li:last-child::after { border: 0 none; }
.dtree li:last-child::before { border-right: 2px solid var(--branch); border-radius: 0 8px 0 0; }
.dtree li:first-child::after { border-radius: 8px 0 0 0; }
/* single child → straight vertical line (keep the gap, drop the horizontal bar) */
.dtree li:only-child::before { display: none; }
.dtree li:only-child::after { border-top: 0; }
/* vertical line from a node down to its children's connector row */
.dtree ul ul::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 2px; height: var(--gap-half, 22px); background: var(--branch);
}

/* Node = rounded-square avatar + name (image-3 look) */
.dtree-node {
    display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
    width: var(--node-w);
    height: var(--node-h);
    justify-content: center;
    padding: 8px 8px 7px;
    border: 1px solid #eef0f4;
    border-radius: 13px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 7px 18px rgba(40, 35, 24, .055);
}
.dtree-av {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: #fbe6c6; color: #98671a; font-weight: 800; font-size: 14px;
    border: 1.5px solid #f0d6a4; box-shadow: 0 4px 10px rgba(150, 110, 20, .10);
}
.dtree-name {
    max-width: calc(var(--node-w) - 14px);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 750;
    color: #2f3744;
    white-space: nowrap;
    line-height: 1.1;
}
.dtree-node.is-inactive { opacity: .95; }
.dtree-node.is-inactive .dtree-av { background: #fff1d2; color: #98671a; border-color: #f0d6a4; }

/* "You" root node — a card */
.dtree-node--you {
    flex-direction: column;
    width: 116px;
    min-width: 116px;
    height: var(--you-h);
    justify-content: center;
    gap: 7px;
    padding: 10px 12px;
    border: 1.5px solid #f0dca8;
    border-radius: 13px;
    background: linear-gradient(180deg, #fffdf8 0%, #fff8ec 100%);
    box-shadow: 0 10px 24px rgba(150, 110, 20, .09);
}
.dtree-av--you {
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: var(--gold-gradient); color: #1a1205; font-size: 16px;
    box-shadow: 0 6px 16px rgba(212, 160, 23, .32);
}
.dtree-av--you svg {
    width: 21px;
    height: 21px;
}
.dtree-node--you .dtree-name {
    max-width: 100%;
    font-size: 13px;
    font-weight: 850;
    color: var(--text);
    text-align: center;
}
.dtree-node--you .dtree-sub {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: left;
}
.dtree-copy {
    min-width: 0;
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.dtree-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 26px 16px 8px; }

@media (max-width: 620px) {
    .dtree-wrap {
        --node-w: 72px;
        --node-h: 66px;
        --you-w: 148px;
        --you-h: 68px;
        --gap: 28px;
        --gap-half: 14px;
        --pad-top: 18px;
        max-height: 68vh;
        min-height: min(460px, calc(var(--pad-top) + var(--you-h) + (var(--tree-depth, 3) * (var(--node-h) + var(--gap))) + 28px));
        padding: 14px 10px 16px 66px;
    }
    .dtree-rail { left: 8px; width: 50px; }
    .dtree-level-label { font-size: 10px; padding: 4px 7px; }
    .dtree li { padding-left: 10px; padding-right: 10px; }
    .dtree { padding: 0 10px; }
    .dtree-node { padding: 7px 7px 6px; }
    .dtree-av { width: 31px; height: 31px; font-size: 12px; }
    .dtree-node--you { width: 104px; min-width: 104px; padding: 9px 12px; }
    .dtree-av--you { width: 40px; height: 40px; }
    .dtree-name { font-size: 10.5px; }
}
