﻿/* =========================================================
   QAI User Panel — Dashboard Styles
   Deep navy / teal crypto aesthetic
   ========================================================= */

:root {
    --qai-bg-0: #061018;
    --qai-bg-1: #0a1824;
    --qai-bg-2: #0f2433;
    --qai-surface: rgba(14, 36, 52, 0.85);
    --qai-surface-solid: #0e2434;
    --qai-border: rgba(0, 174, 239, 0.22);
    --qai-border-strong: rgba(0, 174, 239, 0.4);
    --qai-teal: #00aeef;
    --qai-teal-dim: #0072ff;
    --qai-cyan: #38bdf8;
    --qai-gold: #f5c542;
    --qai-amber: #fb923c;
    --qai-rose: #fb7185;
    --qai-lime: #a3e635;
    --qai-text: #e8f1f5;
    --qai-muted: #8ba3b3;
    --qai-sidebar-w: 268px;
    --qai-radius: 14px;
    --qai-font: 'Plus Jakarta Sans', sans-serif;
    --qai-display: 'Manrope', sans-serif;
    --qai-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body.qai-body {
    font-family: var(--qai-font);
    background: #030a12 !important;
    color: var(--qai-text);
    overflow-x: hidden;
}

/* Atmospheric background */
body.qai-body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 55% 42% at 12% -8%, rgba(0, 174, 239, 0.32), transparent 60%),
        radial-gradient(ellipse 48% 38% at 88% 5%, rgba(56, 189, 248, 0.18), transparent 55%),
        radial-gradient(ellipse 42% 36% at 78% 88%, rgba(20, 184, 166, 0.16), transparent 58%),
        radial-gradient(ellipse 38% 32% at 6% 70%, rgba(0, 114, 255, 0.14), transparent 55%),
        radial-gradient(ellipse 30% 28% at 48% 42%, rgba(0, 174, 239, 0.06), transparent 60%),
        linear-gradient(165deg, #0a1a2a 0%, #071622 28%, #050f18 58%, #030a12 100%);
}

body.qai-body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 100% 80% at 50% 50%, transparent 40%, rgba(2, 8, 14, 0.55) 100%),
        radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, 0.18), transparent),
        radial-gradient(1.5px 1.5px at 28% 62%, rgba(0, 174, 239, 0.35), transparent),
        radial-gradient(1.2px 1.2px at 62% 22%, rgba(255, 255, 255, 0.14), transparent),
        radial-gradient(1.5px 1.5px at 78% 48%, rgba(56, 189, 248, 0.3), transparent),
        radial-gradient(1.2px 1.2px at 88% 78%, rgba(255, 255, 255, 0.12), transparent),
        radial-gradient(1.5px 1.5px at 42% 84%, rgba(0, 174, 239, 0.28), transparent),
        radial-gradient(1px 1px at 55% 12%, rgba(255, 255, 255, 0.16), transparent),
        linear-gradient(rgba(0, 174, 239, 0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 174, 239, 0.028) 1px, transparent 1px);
    background-size:
        auto, auto, auto, auto, auto, auto, auto, auto, 64px 64px, 64px 64px;
}

a { color: var(--qai-teal); text-decoration: none; }
a:hover { color: var(--qai-cyan); }

/* Layout */
.qai-app {
    display: flex;
    min-height: 100vh;
}

.qai-main {
    flex: 1;
    margin-left: var(--qai-sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.qai-main::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 70% 42% at 70% -5%, rgba(0, 174, 239, 0.16), transparent 58%),
        radial-gradient(ellipse 45% 35% at 15% 30%, rgba(56, 189, 248, 0.08), transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 75%, rgba(14, 116, 144, 0.12), transparent 55%),
        linear-gradient(180deg, rgba(7, 24, 38, 0.55) 0%, rgba(4, 14, 22, 0.2) 45%, transparent 100%);
}

.qai-main::after {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    right: -120px;
    top: 12%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle, rgba(0, 174, 239, 0.14) 0%, rgba(0, 174, 239, 0.04) 38%, transparent 68%);
    filter: blur(8px);
    animation: qaiOrbFloat 14s ease-in-out infinite;
}

.qai-main > * {
    position: relative;
    z-index: 1;
}

@keyframes qaiOrbFloat {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
    50% { transform: translate3d(-28px, 36px, 0) scale(1.08); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .qai-main::after { animation: none; }
}

.qai-content {
    flex: 1;
    padding: 1.25rem 1.5rem 2rem;
}

/* ---------- Sidebar ---------- */
.qai-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--qai-sidebar-w);
    height: 100vh;
    background:
        linear-gradient(185deg, #0e2a3d 0%, #0a1f30 42%, #06141f 100%);
    border-right: 1px solid rgba(0, 174, 239, 0.28);
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.28s ease;
    overflow: hidden;
}

.qai-sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 120% 55% at 0% -5%, rgba(0, 174, 239, 0.22), transparent 55%),
        radial-gradient(ellipse 90% 40% at 100% 100%, rgba(56, 189, 248, 0.1), transparent 50%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 28%);
}

.qai-sidebar::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    background-image:
        linear-gradient(rgba(0, 174, 239, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 174, 239, 0.045) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
}

.qai-sidebar > * {
    position: relative;
    z-index: 1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.15rem 1rem;
    border-bottom: 1px solid rgba(0, 174, 239, 0.2);
    background: linear-gradient(180deg, rgba(0, 174, 239, 0.08), transparent);
}

.brand-link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: inherit;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.brand-logo {
    width: auto;
    height: 48px;
    max-width: 200px;
    object-fit: contain;
    flex-shrink: 0;
}

.login-logo {
    display: block;
    width: min(100%, 320px);
    max-width: 100%;
    height: auto;
    max-height: clamp(44px, 12vw, 72px);
    object-fit: contain;
    margin: 0 auto 0.75rem;
}

@media (max-width: 480px) {
    .login-logo {
        width: min(100%, 240px);
        max-height: 52px;
    }
    .login-card {
        padding: 1.5rem 1.15rem;
    }
    .login-brand h1 {
        font-size: 0.88rem;
        letter-spacing: 0.06em;
    }
}


.brand-mark {
    font-family: var(--qai-display);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.025em;
    background: linear-gradient(90deg, var(--qai-teal), var(--qai-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.1;
}

.brand-sub {
    font-size: 0.68rem;
    color: var(--qai-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: var(--qai-muted);
    font-size: 1.2rem;
    padding: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.65rem;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list > li { margin-bottom: 0.2rem; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    color: var(--qai-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 1.05rem;
    width: 1.2rem;
    text-align: center;
    opacity: 0.9;
}

.nav-item:hover {
    background: rgba(0, 174, 239, 0.1);
    color: var(--qai-text);
    border-color: rgba(0, 174, 239, 0.12);
}

.nav-item.active {
    background: linear-gradient(105deg, rgba(0, 174, 239, 0.22), rgba(56, 189, 248, 0.08));
    color: var(--qai-cyan);
    border: 1px solid rgba(0, 174, 239, 0.35);
    box-shadow: inset 3px 0 0 var(--qai-teal);
}

.nav-item.sub {
    padding-left: 2.2rem;
    font-size: 0.85rem;
}

.nav-item .chevron {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.nav-item[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.sub-nav {
    list-style: none;
    margin: 0.15rem 0 0.35rem;
    padding: 0;
}

.nav-divider {
    height: 1px;
    background: var(--qai-border);
    margin: 0.65rem 0.5rem;
}

.sidebar-footer {
    padding: 0.85rem 1rem 1.1rem;
    border-top: 1px solid var(--qai-border);
}

.live-rate-pill {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: rgba(0, 174, 239, 0.08);
    border: 1px solid var(--qai-border);
}

.live-rate-pill .rate-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--qai-muted);
}

.live-rate-pill .rate-value {
    font-family: var(--qai-display);
    font-size: 0.78rem;
    color: var(--qai-teal);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1035;
}

/* ---------- Topbar ---------- */
.qai-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 174, 239, 0.22);
    background: linear-gradient(180deg, rgba(6, 20, 32, 0.92), rgba(5, 14, 22, 0.78));
    backdrop-filter: blur(16px) saturate(1.2);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 174, 239, 0.08);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-toggle {
    background: var(--qai-surface-solid);
    border: 1px solid var(--qai-border);
    color: var(--qai-text);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.page-heading {
    font-family: var(--qai-display);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.page-sub {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--qai-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.live-rate-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(0, 174, 239, 0.1);
    border: 1px solid var(--qai-border-strong);
    animation: rateGlow 2.8s ease-in-out infinite;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--qai-lime);
    box-shadow: 0 0 0 0 rgba(163, 230, 53, 0.5);
    animation: pulseDot 1.6s infinite;
}

.lr-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--qai-muted);
}

.lr-value {
    font-family: var(--qai-display);
    font-size: 0.85rem;
    color: var(--qai-teal);
    font-weight: 600;
}

.lr-value.tick {
    animation: rateTick 0.45s ease;
}
.lr-value.is-up,
[data-live-rate].rate-up { color: #34d399; }
.lr-value.is-down,
[data-live-rate].rate-down { color: #fb7185; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.65rem 0.3rem 0.3rem;
    border-radius: 999px;
    background: var(--qai-surface-solid);
    border: 1px solid var(--qai-border);
}

.user-chip-dropdown {
    position: relative;
}

button.user-chip {
    cursor: pointer;
    color: inherit;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}

button.user-chip::after {
    display: none;
}

.user-chip-caret {
    font-size: 0.72rem;
    color: var(--qai-muted);
    margin-right: 0.15rem;
    transition: transform 0.2s;
}

.user-chip-dropdown .dropdown-toggle.show .user-chip-caret,
.user-chip-dropdown.show .user-chip-caret {
    transform: rotate(180deg);
}

.user-chip:hover,
.user-chip-dropdown .dropdown-toggle.show {
    border-color: rgba(0, 174, 239, 0.45);
    background: rgba(14, 42, 58, 0.95);
}

.user-account-menu {
    min-width: 260px;
    margin-top: 0.45rem !important;
    padding: 0.45rem;
    background: #0b1c2a !important;
    border: 1px solid rgba(0, 174, 239, 0.28) !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.user-account-menu .dropdown-header {
    color: var(--qai-teal);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.45rem 0.75rem 0.2rem;
}

.user-account-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--qai-text);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    font-size: 0.86rem;
}

.user-account-menu .dropdown-item i {
    color: var(--qai-teal);
    width: 1.1rem;
    text-align: center;
}

.user-account-menu .dropdown-item:hover,
.user-account-menu .dropdown-item:focus {
    background: rgba(0, 174, 239, 0.12);
    color: #fff;
}

.user-account-menu .dropdown-divider {
    border-color: rgba(0, 174, 239, 0.18);
    margin: 0.35rem 0;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--qai-teal-dim), #0e7490);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
}

.user-meta strong {
    font-size: 0.78rem;
}

.user-meta small {
    font-size: 0.68rem;
    color: var(--qai-muted);
}

/* ---------- Wallet Grid ---------- */
.wallet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
    margin-bottom: 1.5rem;
}

.wallet-box {
    position: relative;
    border-radius: var(--qai-radius);
    padding: 1.2rem 1.25rem 1.15rem;
    background: var(--qai-surface);
    border: 1px solid var(--qai-border);
    box-shadow: var(--qai-shadow);
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.wallet-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent, var(--qai-teal));
}

.wallet-box:hover {
    transform: translateY(-3px);
    border-color: var(--qai-border-strong);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 24px rgba(0, 174, 239, 0.08);
}

.wallet-box.w-principal { --accent: #00aeef; }
.wallet-box.w-reward { --accent: #f5c542; }
.wallet-box.w-team { --accent: #38bdf8; }
.wallet-box.w-team-reward { --accent: #a3e635; }
.wallet-box.w-withdrawal { --accent: #fb923c; }
.wallet-box.w-total { --accent: #fb7185; }

.wallet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.wallet-title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--qai-muted);
}

.wallet-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 174, 239, 0.12);
    color: var(--accent, var(--qai-teal));
    font-size: 1.1rem;
    flex-shrink: 0;
}

.wallet-amount {
    font-family: var(--qai-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    letter-spacing: -0.02em;
    color: var(--qai-text);
}

.wallet-amount span {
    font-size: 0.75rem;
    color: var(--qai-muted);
    font-family: var(--qai-font);
    font-weight: 500;
    margin-left: 0.25rem;
}

.wallet-qai {
    font-size: 0.88rem;
    color: var(--qai-teal);
    margin-bottom: 0.75rem;
}

.wallet-meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wallet-meta li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--qai-muted);
}

.wallet-meta li i {
    color: var(--accent, var(--qai-teal));
    font-size: 0.85rem;
}

.badge-lock {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(251, 146, 60, 0.15);
    color: var(--qai-amber);
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.badge-open {
    background: rgba(163, 230, 53, 0.12);
    color: var(--qai-lime);
    border-color: rgba(163, 230, 53, 0.3);
}

.countdown {
    font-family: var(--qai-display);
    font-size: 0.82rem;
    color: var(--qai-gold);
    letter-spacing: 0.04em;
    animation: countdownPulse 2s ease-in-out infinite;
}

.countdown.unlocked {
    color: var(--qai-lime);
    animation: none;
}

/* ---------- Panels ---------- */
.panel {
    background: var(--qai-surface);
    border: 1px solid var(--qai-border);
    border-radius: var(--qai-radius);
    padding: 1.25rem;
    box-shadow: var(--qai-shadow);
    margin-bottom: 1.25rem;
}

.panel-title {
    font-family: var(--qai-display);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 1rem;
    letter-spacing: 0.03em;
}

.referral-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.referral-input {
    flex: 1;
    min-width: 200px;
    background: var(--qai-bg-1);
    border: 1px solid var(--qai-border);
    border-radius: 10px;
    color: var(--qai-text);
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
    font-family: var(--qai-font);
}

.referral-input:focus {
    outline: none;
    border-color: var(--qai-teal);
    box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.15);
}

.btn-qai {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: var(--qai-font);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}

.btn-qai:active { transform: scale(0.97); }

.btn-qai-primary {
    background: linear-gradient(135deg, var(--qai-teal-dim), #0e7490);
    color: #042f2e;
}

.btn-qai-primary:hover {
    box-shadow: 0 0 20px rgba(0, 174, 239, 0.35);
    color: #042f2e;
}

.btn-qai-outline {
    background: transparent;
    border-color: var(--qai-border-strong);
    color: var(--qai-teal);
}

.btn-qai-outline:hover {
    background: rgba(0, 174, 239, 0.1);
    color: var(--qai-cyan);
}

.btn-qai-ghost {
    background: var(--qai-bg-2);
    border-color: var(--qai-border);
    color: var(--qai-text);
}

/* Forms */
.form-label-qai {
    font-size: 0.8rem;
    color: var(--qai-muted);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.form-control-qai {
    width: 100%;
    background: var(--qai-bg-1);
    border: 1px solid var(--qai-border);
    border-radius: 10px;
    color: var(--qai-text);
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    font-family: var(--qai-font);
}

.form-control-qai:focus {
    outline: none;
    border-color: var(--qai-teal);
    box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.15);
}

.form-control-qai::placeholder {
    color: #5a7384;
}

.form-lab-spacer {
    display: block;
    min-height: 1.2rem;
    margin-bottom: 0.35rem;
    visibility: hidden;
    user-select: none;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
}

.form-actions .btn-qai {
    min-height: 2.75rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--qai-muted);
    margin-top: 0.35rem;
}

/* Tables */
.table-qai {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-qai thead th {
    text-align: left;
    padding: 0.75rem 0.85rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--qai-muted);
    border-bottom: 1px solid var(--qai-border);
    font-weight: 600;
    white-space: nowrap;
}

.table-qai tbody td {
    padding: 0.8rem 0.85rem;
    border-bottom: 1px solid rgba(56, 189, 168, 0.08);
    color: var(--qai-text);
    vertical-align: middle;
}

.table-qai tbody tr:hover {
    background: rgba(0, 174, 239, 0.04);
}

.status-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-active {
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
}

.status-inactive {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.status-blocked {
    background: rgba(248, 113, 113, 0.18);
    color: #fca5a5;
}

.status-pending {
    background: rgba(245, 197, 66, 0.15);
    color: var(--qai-gold);
}

.status-locked {
    background: rgba(251, 146, 60, 0.15);
    color: var(--qai-amber);
}

/* Media cards */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.media-card {
    border-radius: var(--qai-radius);
    overflow: hidden;
    border: 1px solid var(--qai-border);
    background: var(--qai-bg-1);
}

.media-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #0e2434, #134e4a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--qai-teal);
    font-size: 2.5rem;
}

.media-body {
    padding: 0.85rem 1rem;
}

.media-body h3 {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.media-body p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--qai-muted);
}

/* Alerts */
.alert-qai {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    border: 1px solid var(--qai-border);
    background: rgba(0, 174, 239, 0.08);
    color: var(--qai-text);
    margin-bottom: 1rem;
}

.alert-qai.info {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
}

.alert-qai.warn {
    border-color: rgba(251, 146, 60, 0.35);
    background: rgba(251, 146, 60, 0.08);
}

.alert-qai.success {
    border-color: rgba(163, 230, 53, 0.35);
    background: rgba(163, 230, 53, 0.08);
}

/* ---------- Fund success receipt ---------- */
.fund-success-card {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.25rem;
    padding: 1.35rem 1.4rem 1.15rem;
    border-radius: 18px;
    border: 1px solid rgba(163, 230, 53, 0.35);
    background: linear-gradient(145deg, rgba(18, 48, 40, 0.92), rgba(10, 28, 36, 0.92));
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.fund-success-glow {
    position: absolute;
    width: 280px;
    height: 280px;
    right: -80px;
    top: -100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(163, 230, 53, 0.22), transparent 70%);
    pointer-events: none;
}

.fund-success-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.1rem;
}

.fund-success-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    color: #052e16;
    background: linear-gradient(135deg, #a3e635, #4ade80);
    box-shadow: 0 0 0 6px rgba(163, 230, 53, 0.15);
    flex-shrink: 0;
}

.fund-success-top h2 {
    margin: 0 0 0.2rem;
    font-family: var(--qai-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: #ecfccb;
}

.fund-success-top p {
    margin: 0;
    color: var(--qai-muted);
    font-size: 0.86rem;
}

.fund-success-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.fund-success-stats > div {
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(163, 230, 53, 0.18);
    background: rgba(0, 0, 0, 0.22);
}

.fund-success-stats span {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--qai-muted);
    margin-bottom: 0.25rem;
}

.fund-success-stats strong {
    font-family: var(--qai-display);
    font-size: 1.05rem;
    color: #f0fdf4;
}

.fund-success-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.fund-success-tx {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.78rem;
    color: var(--qai-muted);
    word-break: break-all;
}

.fund-success-tx code {
    color: var(--qai-cyan);
    font-size: 0.75rem;
}

.stat-card-glow {
    border-color: rgba(163, 230, 53, 0.35) !important;
    box-shadow: 0 0 0 1px rgba(163, 230, 53, 0.12), 0 10px 24px rgba(0, 0, 0, 0.2);
}

.fund-row-new td {
    background: rgba(163, 230, 53, 0.08);
}

@media (max-width: 991.98px) {
    .fund-success-stats {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 575.98px) {
    .fund-success-stats {
        grid-template-columns: 1fr;
    }
}

/* Footer */
.qai-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--qai-border);
    text-align: center;
}

.qai-footer p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--qai-muted);
}

/* ---------- Toasts / Live popups ---------- */
.toast-stack {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: 340px;
    width: calc(100% - 2rem);
    pointer-events: none;
}

.qai-toast {
    pointer-events: auto;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(10, 28, 40, 0.95);
    border: 1px solid var(--qai-border-strong);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    animation: toastIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.qai-toast.out {
    animation: toastOut 0.35s ease forwards;
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    background: rgba(0, 174, 239, 0.15);
    color: var(--qai-teal);
}

.qai-toast.type-join .toast-icon { background: rgba(56, 189, 248, 0.15); color: var(--qai-cyan); }
.qai-toast.type-fund .toast-icon { background: rgba(245, 197, 66, 0.15); color: var(--qai-gold); }
.qai-toast.type-withdraw .toast-icon { background: rgba(251, 146, 60, 0.15); color: var(--qai-amber); }
.qai-toast.type-bonus .toast-icon { background: rgba(163, 230, 53, 0.15); color: var(--qai-lime); }

.toast-body { flex: 1; min-width: 0; }
.toast-body strong {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
}
.toast-body p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--qai-muted);
    line-height: 1.4;
}

/* ---------- Login page ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(14, 36, 52, 0.9);
    border: 1px solid var(--qai-border);
    border-radius: 18px;
    padding: 2rem 1.75rem;
    box-shadow: var(--qai-shadow);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.login-brand .login-logo {
    max-width: 100%;
}

.login-brand .brand-mark {
    font-size: 2.4rem;
    display: block;
}

.login-brand .brand-sub {
    display: block;
    margin-top: 0.35rem;
}

.login-brand h1 {
    font-family: var(--qai-display);
    font-size: 1rem;
    margin: 1rem 0 0;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--qai-muted);
}

.login-error {
    background: rgba(251, 113, 133, 0.12);
    border: 1px solid rgba(251, 113, 133, 0.35);
    color: var(--qai-rose);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.demo-hint {
    margin-top: 1.25rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(0, 174, 239, 0.06);
    border: 1px dashed var(--qai-border);
    font-size: 0.75rem;
    color: var(--qai-muted);
    text-align: center;
}

.demo-hint code {
    color: var(--qai-teal);
    font-size: 0.75rem;
}

/* Stats row for secondary pages */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    padding: 1rem;
    border-radius: 12px;
    background: var(--qai-surface);
    border: 1px solid var(--qai-border);
}

.stat-card .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--qai-muted);
    margin-bottom: 0.35rem;
}

.stat-card .value {
    font-family: var(--qai-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--qai-teal);
}

/* Tree visual */
.tree-levels {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.85rem;
}

.tree-level {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1rem 1.05rem;
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(0, 174, 239, 0.08), transparent 55%),
        var(--qai-bg-1);
    border: 1px solid var(--qai-border);
}

.tree-level-badge {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-family: var(--qai-display);
    font-weight: 700;
    font-size: 0.85rem;
    color: #041018;
    background: linear-gradient(135deg, var(--qai-teal), #38bdf8);
}

.tree-level-body {
    min-width: 0;
    flex: 1;
}

.tree-level h4 {
    margin: 0 0 0.45rem;
    font-size: 0.85rem;
    color: var(--qai-text);
    font-family: var(--qai-display);
}

.tree-level-meta {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    font-size: 0.8rem;
    color: var(--qai-muted);
}

.tree-level-meta strong {
    color: var(--qai-text);
}

.tree-level-meta i {
    color: var(--qai-teal);
    margin-right: 0.2rem;
}

.tree-stat-row .stat-card-ok .value {
    color: #22c55e;
}

.tree-stat-row .stat-card-warn .value {
    color: #f87171;
}

.tree-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tree-table-count {
    font-size: 0.78rem;
    color: var(--qai-muted);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--qai-border);
    background: var(--qai-bg-1);
}

.tree-filter-bar {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 0.7fr) auto;
    gap: 0.75rem 1rem;
    align-items: end;
    margin-bottom: 0.85rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: var(--qai-bg-1);
    border: 1px solid var(--qai-border);
}

.tree-filter-field.grow {
    min-width: 0;
}

.tree-filter-actions .form-actions {
    margin: 0;
}

.tree-status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.tree-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--qai-muted);
    border: 1px solid var(--qai-border);
    background: transparent;
    transition: background .15s, color .15s, border-color .15s;
}

.tree-chip:hover {
    color: var(--qai-text);
    border-color: rgba(0, 174, 239, 0.45);
}

.tree-chip.is-on {
    color: #041018;
    background: linear-gradient(135deg, var(--qai-teal), #38bdf8);
    border-color: transparent;
}

.tree-chip.chip-ok.is-on {
    background: rgba(34, 197, 94, 0.22);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.35);
}

.tree-chip.chip-warn.is-on {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}

.tree-uid {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    color: var(--qai-teal);
    font-weight: 600;
}

.tree-lvl {
    display: inline-block;
    min-width: 2rem;
    text-align: center;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(0, 174, 239, 0.12);
    color: var(--qai-teal);
}

.tree-members-table tbody tr:nth-child(even) {
    background: rgba(0, 174, 239, 0.03);
}

@media (max-width: 768px) {
    .tree-filter-bar {
        grid-template-columns: 1fr;
    }
}

/* ---------- Genealogy Tree ---------- */
.genealogy-wrap {
    overflow-x: auto;
    padding: 0.5rem 0.25rem 1rem;
}

.genealogy-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--qai-muted);
}

.genealogy-empty i {
    font-size: 2rem;
    color: var(--qai-teal);
    display: block;
    margin-bottom: 0.75rem;
}

.genealogy-tree {
    display: inline-block;
    min-width: 100%;
    text-align: center;
}

.genealogy-tree ul {
    padding-top: 24px;
    position: relative;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.genealogy-tree li {
    display: inline-block;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 24px 12px 0;
    vertical-align: top;
}

/* Connectors */
.genealogy-tree li::before,
.genealogy-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid rgba(0, 174, 239, 0.35);
    width: 50%;
    height: 24px;
}

.genealogy-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid rgba(0, 174, 239, 0.35);
}

.genealogy-tree li:only-child::after,
.genealogy-tree li:only-child::before {
    display: none;
}

.genealogy-tree li:only-child {
    padding-top: 0;
}

.genealogy-tree li:first-child::before,
.genealogy-tree li:last-child::after {
    border: 0 none;
}

.genealogy-tree li:last-child::before {
    border-right: 2px solid rgba(0, 174, 239, 0.35);
    border-radius: 0 8px 0 0;
}

.genealogy-tree li:first-child::after {
    border-radius: 8px 0 0 0;
}

.genealogy-tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid rgba(0, 174, 239, 0.35);
    width: 0;
    height: 24px;
}

.gen-node {
    position: relative;
    display: inline-block;
    min-width: 148px;
    max-width: 180px;
    padding: 0.85rem 0.75rem 0.7rem;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(16, 42, 58, 0.98), rgba(8, 24, 36, 0.95));
    border: 1px solid rgba(0, 174, 239, 0.28);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    text-align: center;
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.gen-node:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 174, 239, 0.55);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}

.gen-node.gen-root {
    border-color: rgba(163, 230, 53, 0.45);
    background: linear-gradient(160deg, rgba(24, 52, 40, 0.98), rgba(10, 28, 36, 0.95));
    box-shadow: 0 0 0 1px rgba(163, 230, 53, 0.12), 0 12px 28px rgba(0, 0, 0, 0.3);
}

.gen-avatar {
    width: 42px;
    height: 42px;
    margin: 0 auto 0.45rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: var(--qai-display);
    color: #fff;
    background: linear-gradient(135deg, #0072ff, #0e7490);
}

.gen-root .gen-avatar {
    background: linear-gradient(135deg, #65a30d, #a3e635);
    color: #052e16;
}

.gen-id {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--qai-cyan);
    letter-spacing: 0.02em;
}

.gen-name {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0.15rem 0 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gen-meta {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    font-size: 0.7rem;
    color: var(--qai-muted);
}

.gen-meta span {
    background: rgba(0, 174, 239, 0.1);
    border: 1px solid rgba(0, 174, 239, 0.18);
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
}

.gen-joined {
    margin-top: 0.35rem;
    font-size: 0.68rem;
    color: var(--qai-muted);
}

.gen-status {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--qai-lime);
}

.gen-node.status-active .gen-status {
    color: #22c55e;
}

.gen-node.status-inactive .gen-status {
    color: #ef4444;
}

.gen-node.status-blocked .gen-status {
    color: var(--qai-rose);
}

.gen-focus {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 174, 239, 0.15);
    border: 1px solid rgba(0, 174, 239, 0.3);
    color: var(--qai-teal);
    font-size: 0.75rem;
}

.gen-focus:hover {
    background: rgba(0, 174, 239, 0.28);
    color: #fff;
}

/* Animations */
@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 rgba(163, 230, 53, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(163, 230, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(163, 230, 53, 0); }
}

@keyframes rateGlow {
    0%, 100% { box-shadow: 0 0 0 rgba(0, 174, 239, 0); }
    50% { box-shadow: 0 0 16px rgba(0, 174, 239, 0.2); }
}

@keyframes rateTick {
    0% { transform: scale(1); color: var(--qai-teal); }
    40% { transform: scale(1.08); color: var(--qai-lime); }
    100% { transform: scale(1); color: var(--qai-teal); }
}

@keyframes countdownPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.72; }
}

@keyframes walletIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* User report tiles */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.report-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--qai-surface);
    border: 1px solid var(--qai-border);
    border-radius: var(--qai-radius);
    padding: 1.15rem;
    transition: border-color .2s, transform .15s;
}
.report-tile:hover {
    border-color: var(--qai-border-strong);
    transform: translateY(-2px);
    color: inherit;
}
.report-tile i {
    font-size: 1.35rem;
    color: var(--qai-teal);
    display: block;
    margin-bottom: .5rem;
}
.report-tile h3 {
    margin: 0 0 .35rem;
    font-size: .95rem;
    font-family: var(--qai-display);
    font-weight: 700;
}
.report-tile p {
    margin: 0;
    font-size: .78rem;
    color: var(--qai-muted);
}

    .wallet-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991.98px) {
    .qai-sidebar {
        transform: translateX(-100%);
    }

    .qai-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .qai-main {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .wallet-grid {
        grid-template-columns: 1fr;
    }

    .qai-content {
        padding: 1rem;
    }

    .qai-topbar {
        padding: 0.85rem 1rem;
    }

    .live-rate-badge .lr-label {
        display: none;
    }

    .wallet-amount {
        font-size: 1.25rem;
    }
}
