
/* ============ TOKENS ============ */
:root {
    --font-head: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 22px;
    --sidebar-w: 252px;
    --sidebar-w-collapsed: 78px;
    --topbar-h: 66px;

    /* Dark palette (default) */
    --bg: #0A1120;
    --surface: #101A2E;
    --surface-2: #16213A;
    --surface-3: #1C2A46;
    --border: #223154;
    --text: #E7EDF8;
    --text-muted: #8CA0C6;
    --text-faint: #5D6E90;
    --primary: #2F6FED;
    --primary-ink: #EAF1FF;
    --accent: #19D896;
    --accent-ink: #04140D;
    --warn: #F2B84B;
    --danger: #F2545B;
    --info: #8B6CF0;
    --grad-hero: radial-gradient(circle at 20% 20%, rgba(47,111,237,.35), transparent 55%), radial-gradient(circle at 85% 15%, rgba(25,216,150,.28), transparent 50%), linear-gradient(180deg,#0A1120,#0A1120);
    --shadow-card: 0 10px 30px -14px rgba(0,0,0,.5);
}

:root[data-theme="light"] {
    --bg: #F3F6FC;
    --surface: #FFFFFF;
    --surface-2: #EEF3FA;
    --surface-3: #E5ECF7;
    --border: #DCE5F3;
    --text: #0E1626;
    --text-muted: #5A6C8C;
    --text-faint: #8595B2;
    --primary: #2158D6;
    --primary-ink: #FFFFFF;
    --accent: #0EA96F;
    --accent-ink: #EFFFF8;
    --warn: #9C6A05;
    --danger: #C93B44;
    --info: #6A4FD6;
    --grad-hero: radial-gradient(circle at 20% 20%, rgba(47,111,237,.12), transparent 55%), radial-gradient(circle at 85% 15%, rgba(14,169,111,.12), transparent 50%), linear-gradient(180deg,#F3F6FC,#F3F6FC);
    --shadow-card: 0 10px 24px -16px rgba(30,50,90,.28);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #F3F6FC;
        --surface: #FFFFFF;
        --surface-2: #EEF3FA;
        --surface-3: #E5ECF7;
        --border: #DCE5F3;
        --text: #0E1626;
        --text-muted: #5A6C8C;
        --text-faint: #8595B2;
        --primary: #2158D6;
        --primary-ink: #FFFFFF;
        --accent: #0EA96F;
        --accent-ink: #EFFFF8;
        --warn: #9C6A05;
        --danger: #C93B44;
        --info: #6A4FD6;
        --shadow-card: 0 10px 24px -16px rgba(30,50,90,.28);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
}

html {
    scroll-padding-top: env(safe-area-inset-top,0px);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    padding-top: env(safe-area-inset-top,0px);
    padding-bottom: env(safe-area-inset-bottom,0px);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand, .stat-value {
    font-family: var(--font-head);
}

a {
    text-decoration: none;
    color: inherit;
}

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

.text-muted-c {
    color: var(--text-muted) !important;
}

.small-caps {
    font-size: .72rem;
    letter-spacing: .02em;
    color: var(--text-muted);
}

button {
    font-family: var(--font-body);
}

.container-x {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============ BUTTONS ============ */
.btn-nx {
    border-radius: 12px;
    padding: .65rem 1.3rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: transform .15s ease, background .2s ease;
}

    .btn-nx:active {
        transform: scale(.98);
    }

.btn-nx-primary {
    background: linear-gradient(135deg,var(--primary),#1C4FC0);
    color: var(--primary-ink);
}

    .btn-nx-primary:hover {
        filter: brightness(1.08);
        color: var(--primary-ink);
    }

.btn-nx-accent {
    background: var(--accent);
    color: var(--accent-ink);
}

    .btn-nx-accent:hover {
        filter: brightness(1.06);
        color: var(--accent-ink);
    }

.btn-nx-ghost {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

    .btn-nx-ghost:hover {
        background: var(--surface-3);
        color: var(--text);
    }

.btn-nx-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

    .btn-nx-outline:hover {
        background: var(--surface-2);
        color: var(--text);
    }

/* ============ CARD ============ */
.nx-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-card);
}

.nx-card-pad {
    padding: 22px;
}

/* ============ PUBLIC NAV ============ */
.public-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    border-bottom: 1px solid var(--border);
}

    .public-nav .container-x {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 72px;
    }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.28rem;
    letter-spacing: -.01em;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg,var(--primary),var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.05rem;
}

.public-nav nav a {
    color: var(--text-muted);
    font-weight: 500;
    margin: 0 12px;
    font-size: .94rem;
}

    .public-nav nav a:hover {
        color: var(--text);
    }

.public-mobile-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    color: var(--text);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.public-mobile-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 14px 24px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

    .public-mobile-menu.show {
        display: flex;
    }

    .public-mobile-menu a {
        color: var(--text-muted);
        font-weight: 500;
        font-size: .96rem;
        padding: 9px 6px;
        border-radius: 8px;
    }

        .public-mobile-menu a:hover {
            background: var(--surface-2);
            color: var(--text);
        }

/* ============ HOME / HERO ============ */
.hero {
    background: var(--grad-hero);
    padding: 72px 0 40px;
    position: relative;
    overflow: hidden;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 99px;
    font-size: .82rem;
    color: var(--text-muted);
}

.hero h1 {
    font-size: clamp(2.1rem,4.4vw,3.4rem);
    line-height: 1.08;
    margin: 18px 0 16px;
    letter-spacing: -.02em;
}

.hero p.lead {
    color: var(--text-muted);
    font-size: 1.08rem;
    max-width: 520px;
}

.hero-stats {
    display: flex;
    gap: 28px;
    margin-top: 30px;
    flex-wrap: wrap;
}

    .hero-stats div b {
        display: block;
        font-family: var(--font-head);
        font-size: 1.5rem;
    }

.coin-orbit {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.section-pad {
    padding: 64px 0;
}

.section-head {
    max-width: 560px;
    margin: 0 auto 40px;
    text-align: center;
}

    .section-head h2 {
        font-size: clamp(1.6rem,3vw,2.2rem);
        letter-spacing: -.02em;
        margin-bottom: 10px;
    }

.income-pill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(230px,1fr));
    gap: 16px;
}

.income-pill {
    padding: 20px;
    border-radius: var(--radius-m);
    background: var(--surface);
    border: 1px solid var(--border);
}

    .income-pill .ic {
        width: 42px;
        height: 42px;
        border-radius: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

.step-row {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(230px,1fr));
    gap: 18px;
}

.step-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 22px;
}

    .step-card .n {
        font-family: var(--font-head);
        font-size: 1.6rem;
        color: var(--primary);
    }

.footer-public {
    border-top: 1px solid var(--border);
    padding: 26px 0;
    color: var(--text-faint);
    font-size: .85rem;
}

/* ============ AUTH ============ */
.auth-wrap {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 18px;
    background: var(--grad-hero);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.form-control-nx, .form-select-nx {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: .62rem .85rem;
}

    .form-control-nx:focus, .form-select-nx:focus {
        background: var(--surface-2);
        color: var(--text);
        border-color: var(--primary);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
        outline: none;
    }

.form-label-nx {
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.divider-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-faint);
    font-size: .8rem;
    margin: 18px 0;
}

    .divider-or::before, .divider-or::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--border);
    }

/* ============ APP SHELL ============ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: width .22s ease, transform .25s ease;
    padding-top: env(safe-area-inset-top,0px);
    padding-bottom: env(safe-area-inset-bottom,0px);
}

    .sidebar.collapsed {
        width: var(--sidebar-w-collapsed);
    }

.sidebar-head {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

    .sidebar-head .brand {
        font-size: 1.08rem;
        white-space: nowrap;
        overflow: hidden;
    }

.sidebar.collapsed .sidebar-head .brand span {
    display: none;
}

.sidebar-toggle-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 30px;
    height: 30px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
}

.nav-section-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    padding: 14px 12px 6px;
}

.sidebar.collapsed .nav-section-label {
    display: none;
}

.nx-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: .92rem;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}

    .nx-link i {
        font-size: 1.05rem;
        width: 20px;
        text-align: center;
        flex-shrink: 0;
    }

    .nx-link:hover {
        background: var(--surface-2);
        color: var(--text);
    }

    .nx-link.active {
        background: color-mix(in srgb, var(--primary) 14%, transparent);
        color: var(--primary);
    }

.sidebar.collapsed .nx-link span, .sidebar.collapsed .nx-link .chev {
    display: none;
}

.nx-link .chev {
    margin-left: auto;
    font-size: .8rem;
    transition: transform .2s;
}

.nx-link.open .chev {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    padding-left: 34px;
    margin: 2px 0 6px;
    display: none;
}

    .submenu a {
        display: block;
        padding: 8px 10px;
        font-size: .86rem;
        color: var(--text-muted);
        border-radius: 8px;
    }

        .submenu a:hover, .submenu a.active {
            color: var(--primary);
            background: var(--surface-2);
        }

.sidebar.collapsed .submenu {
    display: none !important;
}

.sidebar-foot {
    padding: 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg,var(--primary),var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: .9rem;
    flex-shrink: 0;
}

.sidebar.collapsed .user-chip .who {
    display: none;
}

.user-chip .who b {
    display: block;
    font-size: .85rem;
}

.user-chip .who small {
    color: var(--text-faint);
}

.main-col {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left .22s ease;
    min-width: 0;
}

    .main-col.collapsed {
        margin-left: var(--sidebar-w-collapsed);
    }

.topbar {
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(8px);
    z-index: 30;
    padding-top: env(safe-area-inset-top,0px);
}

.hamburger-mobile {
    display: none;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    color: var(--text);
    align-items: center;
    justify-content: center;
}

.theme-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 4px;
}

    .theme-switch button {
        border: none;
        background: transparent;
        width: 32px;
        height: 28px;
        border-radius: 99px;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .theme-switch button.active {
            background: var(--surface-3);
            color: var(--text);
        }

.page-content {
    padding: 26px 22px 60px;
}

.page-section {
    display: none;
}

    .page-section.active {
        display: block;
        animation: fadein .25s ease;
    }

@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}

    .page-title-row h2 {
        margin: 0 0 4px;
        font-size: 1.5rem;
        letter-spacing: -.01em;
    }

.breadcrumb-nx {
    font-size: .82rem;
    /*color: var(--text-faint);*/
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 45;
}

    .sidebar-overlay.show {
        display: block;
    }

/* ============ INCOME CARDS ============ */
.income-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(240px,1fr));
    gap: 16px;
}

.income-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 18px;
    box-shadow: var(--shadow-card);
}

    .income-card .top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 14px;
    }

    .income-card .ic {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.05rem;
    }

    .income-card .amt {
        font-family: var(--font-head);
        font-size: 1.5rem;
    }

    .income-card .lbl {
        color: var(--text-muted);
        font-size: .86rem;
        margin-top: 2px;
    }

.trend-up {
    color: var(--accent);
    font-size: .78rem;
    font-weight: 600;
}

.trend-down {
    color: var(--danger);
    font-size: .78rem;
    font-weight: 600;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.stat-value {
    font-size: 1.7rem;
}

.progress-nx {
    height: 8px;
    border-radius: 99px;
    background: var(--surface-3);
    overflow: hidden;
}

    .progress-nx > div {
        height: 100%;
        border-radius: 99px;
        background: linear-gradient(90deg,var(--primary),var(--accent));
    }

/* ============ TABLE ============ */
.table-nx {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .9rem;
}

    .table-nx thead th {
        text-align: left;
        color: var(--text-faint);
        font-weight: 600;
        font-size: .74rem;
        text-transform: uppercase;
        letter-spacing: .05em;
        padding: 10px 14px;
        border-bottom: 1px solid var(--border);
    }

    .table-nx tbody td {
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
    }

    .table-nx tbody tr:hover {
        background: var(--surface-2);
    }

.badge-nx {
    padding: .32em .7em;
    border-radius: 99px;
    font-size: .74rem;
    font-weight: 600;
}

.badge-success {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
}

.badge-warn {
    background: color-mix(in srgb, var(--warn) 20%, transparent);
    color: var(--warn);
}

.badge-danger {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    color: var(--danger);
}

.badge-info {
    background: color-mix(in srgb, var(--info) 18%, transparent);
    color: var(--info);
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

/* scrollable wide content */
.scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* misc */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: .78rem;
    color: var(--text-muted);
}

.copy-box {
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: .88rem;
}

.avatar-lg {
    width: 84px;
    height: 84px;
    border-radius: 18px;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        width: min(var(--sidebar-w), 82vw) !important;
        box-shadow: 0 0 40px rgba(0,0,0,.35);
    }

        .sidebar.show {
            transform: translateX(0);
        }

    .main-col, .main-col.collapsed {
        margin-left: 0;
    }

    .hamburger-mobile {
        display: flex;
    }

    .hero-stats {
        gap: 20px;
    }
}

body.no-scroll {
    overflow: hidden;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-card);
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding: 15px;
}

h1, h2, h3, h4, h5, h6, .brand, .stat-value, p {
    color: var(--text) !important;
}

.card-title {
    font-size: 1.5rem;
}

.table {
    --bs-table-color: var(--text);
    --bs-table-bg: var(--surface);
    --bs-table-border-color: var(--border);
}

