:root {
    --bg: #070d26;
    --panel: #0d162b;
    --panel-soft: #131f35;
    --border: rgba(0, 255, 145, .28);
    --green: #00e887;
    --green-dark: #06b760;
    --text: #f7f8fb;
    --muted: #9ca4b8;
    --yellow: #ffc400;
    --blue: #2f89ff;
    --purple: #af44ff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif; }
a { color: inherit; text-decoration: none; }
img, canvas, svg { max-width: 100%; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { background: #0b1326; border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 16px; padding: 32px 26px; color: var(--green); font-size: 1.35rem; }
.brand-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--green); color: #061022; }
.profile { display: flex; gap: 16px; align-items: center; padding: 28px 26px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #061022; font-weight: 800; }
.profile-name { font-weight: 800; font-size: 1.1rem; }
.rank-badge { background: #c9850e; border-radius: 999px; padding: 3px 12px; font-size: .85rem; }
.nav-list { padding: 24px 18px; display: grid; gap: 10px; }
.nav-list a { display: flex; align-items: center; gap: 16px; padding: 17px 20px; border-radius: 12px; color: #cbd2df; font-weight: 700; font-size: 1.05rem; }
.nav-list a i { font-size: 1.35rem; }
.nav-list a.active, .nav-list a:hover { background: linear-gradient(135deg, #00f08c, #08ce72); color: #061022; }
.mobile-taskbar { display: none; }
.mobile-menu-toggle,
.sidebar-backdrop { display: none; }
.main-content { padding: 38px; min-width: 0; overflow-x: hidden; }
.page-title { display: flex; justify-content: space-between; gap: 22px; align-items: center; margin-bottom: 28px; }
.page-title h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1; font-weight: 900; margin: 0 0 14px; }
.page-title p, .muted { color: var(--muted); margin: 0; }
.panel, .stat-card, .ticker-strip, .notice-bar { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; }
.panel { padding: 26px; }
.panel h2 { font-size: 1.45rem; font-weight: 850; margin-bottom: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.stats-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { padding: 22px; min-height: 150px; display: grid; align-content: center; gap: 8px; }
.stat-card i { font-size: 1.7rem; }
.stat-card span, .rule-list span, .balance-box span { color: var(--muted); }
.stat-card strong { font-size: 1.7rem; line-height: 1.1; }
.stat-card small { color: var(--muted); }
.content-grid { display: grid; gap: 24px; }
.content-grid.two { grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); }
.rule-list { display: grid; }
.rule-list div { display: flex; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.text-green { color: var(--green) !important; }
.text-blue { color: var(--blue) !important; }
.text-yellow { color: var(--yellow) !important; }
.text-purple { color: var(--purple) !important; }
.form-control, .form-select { background: var(--panel-soft); border: 1px solid var(--border); color: var(--text); min-height: 52px; }
.form-control:focus, .form-select:focus { background: var(--panel-soft); color: var(--text); border-color: var(--green); box-shadow: 0 0 0 .2rem rgba(0,232,135,.12); }
.form-control::placeholder { color: #697386; }
.password-field { position: relative; }
.password-field .form-control { padding-right: 54px; }
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.15rem; }
.password-toggle:hover, .password-toggle:focus { color: var(--green); background: rgba(0,232,135,.1); outline: 0; }
.btn-success { background: var(--green); border-color: var(--green); color: #061022; font-weight: 800; }
.table-dark { --bs-table-bg: transparent; --bs-table-border-color: rgba(255,255,255,.08); }
.notice-bar { border-color: var(--yellow); display: flex; gap: 16px; padding: 24px; }
.notice-bar i, .notice-bar b { color: var(--yellow); }
.notice-bar p { color: #d1d6e2; margin: 10px 0; }
.progress, .mini-progress { background: #1d2840; border-radius: 999px; overflow: hidden; }
.progress { height: 10px; }
.progress-bar, .mini-progress span { background: linear-gradient(90deg, var(--yellow), #ff7b00); display: block; height: 100%; }
.balance-box { border: 1px solid var(--border); border-radius: 14px; padding: 22px; position: relative; background: #101a31; }
.balance-box strong { display: block; font-size: 2rem; }
.balance-box i { position: absolute; right: 22px; top: 26px; width: 58px; height: 58px; border-radius: 14px; display: grid; place-items: center; background: var(--green); color: #061022; font-size: 1.7rem; }
.payment-box { border: 1px solid var(--border); border-radius: 14px; padding: 18px; background: var(--panel-soft); }
.payment-box span { color: var(--muted); }
.payment-box strong { display: block; font-size: 1.5rem; overflow-wrap: anywhere; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #102044, var(--bg)); }
.auth-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 32px; }
.auth-tabs .nav-link { color: var(--muted); }
.auth-tabs .nav-link.active { background: var(--green); color: #061022; font-weight: 800; }
.home-body { background: var(--bg); min-height: 100vh; padding-bottom: 0; }
.auth-home {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 480px);
    background: var(--bg);
}
.auth-hero-panel {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    display: grid;
    align-items: end;
    padding: clamp(24px, 5vw, 62px);
}
.auth-hero-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(7,13,38,.96) 0%, rgba(7,13,38,.68) 46%, rgba(7,13,38,.9) 100%),
        url('../images/homepage-dashboard.png') center / cover no-repeat;
    transform: scale(1.02);
}
.auth-hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: clamp(28px, 7vh, 80px);
    max-width: 760px;
}
.auth-hero-content .brand {
    padding: 0;
}
.auth-hero-content h1 {
    font-size: clamp(2.6rem, 5vw, 5.4rem);
    line-height: 1;
    font-weight: 950;
    margin: 0 0 18px;
}
.auth-hero-content p {
    max-width: 660px;
    color: #c2cad8;
    font-size: 1.12rem;
    line-height: 1.65;
}
.auth-preview-image {
    margin: 0;
    width: min(760px, 100%);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(0,0,0,.42);
    background: var(--panel);
}
.auth-preview-image img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 7.8;
    object-fit: cover;
    object-position: top left;
}
.auth-hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 620px;
}
.auth-hero-metrics div {
    border: 1px solid var(--border);
    background: rgba(13, 22, 43, .82);
    border-radius: 14px;
    padding: 16px;
}
.auth-hero-metrics strong {
    display: block;
    font-size: 1.45rem;
}
.auth-hero-metrics span {
    color: var(--muted);
}
.auth-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(18px, 4vw, 38px);
    border-left: 1px solid var(--border);
    background: #0a1226;
}
.auth-panel .auth-card {
    width: 100%;
}
.auth-card-brand {
    display: none;
    padding: 0 0 18px;
}
.access-copy h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 900;
}
.home-nav { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(18px, 4vw, 54px); background: rgba(7, 13, 38, .86); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.home-nav .brand { padding: 0; }
.home-nav-actions { display: flex; align-items: center; gap: 18px; color: #cbd2df; font-weight: 700; }
.home-page { width: min(1480px, 100%); margin: 0 auto; padding: 42px clamp(16px, 4vw, 54px) 0; }
.home-hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); gap: clamp(26px, 5vw, 70px); align-items: center; min-height: calc(100vh - 110px); }
.compact-home { padding-top: 28px; }
.compact-home .home-hero { grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); min-height: auto; align-items: start; }
.compact-home .home-hero h1 { font-size: clamp(2rem, 4vw, 4rem); }
.compact-home .home-hero p { max-width: 650px; }
.compact-access { display: block; padding: 0; margin: 0; background: transparent; border: 0; }
.compact-access .auth-card { box-shadow: 0 26px 70px rgba(0,0,0,.32); }
.compact-access .access-copy h2 { font-size: 1.65rem; margin-bottom: 0; }
.compact-preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 20px; align-items: stretch; padding: 34px 0 54px; }
.compact-preview .home-visual img { height: 100%; object-fit: cover; object-position: top left; }
.eyebrow { display: inline-flex; color: var(--green); font-weight: 850; letter-spacing: 0; margin-bottom: 16px; }
.home-hero h1, .section-copy h2, .home-network h2, .home-access h2 { font-size: clamp(2.2rem, 5vw, 5rem); line-height: 1.02; font-weight: 950; margin: 0 0 18px; }
.section-copy h2, .home-network h2, .home-access h2 { font-size: clamp(1.9rem, 3.6vw, 3.4rem); }
.home-hero p, .section-copy p, .home-network p, .home-access p { color: var(--muted); font-size: 1.1rem; line-height: 1.7; max-width: 720px; }
.home-hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }
.home-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.home-metrics div, .home-stats article, .network-card, .home-access, .home-chart-card, .showcase-grid figure { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; }
.home-metrics div { padding: 18px; }
.home-metrics strong { display: block; font-size: 1.6rem; }
.home-metrics span { color: var(--muted); }
.home-visual { position: relative; min-width: 0; }
.home-visual > img { width: 100%; border-radius: 18px; border: 1px solid var(--border); box-shadow: 0 30px 90px rgba(0,0,0,.42); display: block; }
.home-chart-card { position: absolute; left: 24px; right: 24px; bottom: -48px; padding: 18px; box-shadow: 0 24px 50px rgba(0,0,0,.34); }
.home-chart-card > div { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.home-chart-card span { color: var(--muted); }
.home-chart-card strong { color: var(--green); font-size: 1.3rem; }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin: 80px 0 34px; }
.home-stats article { padding: 24px; min-height: 180px; display: grid; align-content: start; gap: 10px; }
.home-stats i { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--green); color: #061022; font-size: 1.4rem; }
.home-stats strong { font-size: 1.2rem; }
.home-stats span { color: var(--muted); line-height: 1.55; }
.home-showcase, .home-network, .home-access { padding: 58px 0; }
.showcase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.showcase-grid figure { overflow: hidden; margin: 0; }
.showcase-grid img { width: 100%; display: block; aspect-ratio: 16 / 8.5; object-fit: cover; object-position: top left; border-bottom: 1px solid var(--border); }
.showcase-grid figcaption { padding: 16px 18px; color: #d8deea; font-weight: 800; }
.home-network { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, .6fr); gap: 24px; align-items: stretch; }
.network-card { padding: clamp(26px, 4vw, 42px); }
.network-flow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }
.network-flow span { background: var(--panel-soft); border: 1px solid rgba(255,255,255,.08); border-radius: 999px; padding: 10px 16px; font-weight: 800; }
.network-flow i { color: var(--green); }
.network-chart { padding: 24px; }
.home-access { display: grid; grid-template-columns: minmax(0, .8fr) minmax(360px, 460px); gap: 28px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: clamp(24px, 4vw, 42px); margin-bottom: 54px; }
.home-access .auth-card { width: 100%; }
.home-footer { border-top: 1px solid var(--border); color: var(--muted); text-align: center; padding: 24px; }
.ticker-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding: 24px; overflow: hidden; }
.ticker-strip div { display: grid; }
.ticker-strip span { color: var(--muted); }
.ticker-strip b { color: var(--green); }
.mode-pill { display: flex; align-items: center; gap: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; color: var(--muted); }
.switch-dot { width: 70px; height: 36px; border-radius: 999px; background: var(--green); position: relative; }
.switch-dot:after { content: ""; position: absolute; top: 5px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: #fff; }
.switch-dot.real:after { left: 6px; right: auto; }
.signal-card { border-radius: 14px; min-height: 190px; display: grid; place-items: center; text-align: center; padding: 24px; background: linear-gradient(140deg, #0bb957, #08714c); border: 2px solid var(--green); }
.signal-card strong { font-size: 4rem; line-height: 1; color: #24ffa0; }
.signal-card.sell { background: linear-gradient(140deg, #7f2233, #311327); border-color: #ff6075; }
.signal-card.hold { background: linear-gradient(140deg, #7b6110, #342b12); border-color: var(--yellow); }
.trading-visual { position: relative; min-height: 280px; overflow: hidden; background: radial-gradient(circle at 20% 20%, rgba(47,137,255,.24), transparent 36%), #091429; }
.trading-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 44px 44px; animation: market-pan 12s linear infinite; opacity: .55; }
.trading-line { position: absolute; left: 4%; right: 4%; bottom: 22%; height: 48%; clip-path: polygon(0 76%, 12% 58%, 24% 66%, 36% 38%, 48% 52%, 60% 22%, 72% 32%, 84% 16%, 100% 28%, 100% 100%, 0 100%); background: linear-gradient(180deg, rgba(0,232,135,.62), rgba(0,232,135,0)); border-top: 4px solid var(--green); filter: drop-shadow(0 0 16px rgba(0,232,135,.45)); animation: trade-pulse 2.6s ease-in-out infinite; }
.trading-candles { position: absolute; inset: 28px; display: flex; align-items: end; gap: 12px; opacity: .9; }
.trading-candles i { width: 12px; border-radius: 999px; background: var(--green); box-shadow: 0 -14px 0 -4px rgba(0,232,135,.35), 0 14px 0 -4px rgba(0,232,135,.35); animation: candle-rise 2.8s ease-in-out infinite; }
.trading-candles i:nth-child(2n) { background: #ff6075; animation-delay: -.6s; }
.trading-candles i:nth-child(3n) { height: 62%; animation-delay: -1.1s; }
.trading-candles i:nth-child(4n) { height: 40%; animation-delay: -1.7s; }
.ai-chip-stream { position: absolute; left: 24px; right: 24px; bottom: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.ai-chip-stream span { border: 1px solid rgba(255,255,255,.12); background: rgba(13,22,43,.82); border-radius: 999px; padding: 8px 12px; color: #d9e2ef; font-weight: 800; font-size: .82rem; }
.p2p-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 260px; min-height: 230px; align-items: center; }
.p2p-hero h2 { font-size: clamp(1.8rem, 3.4vw, 3rem); margin-bottom: 12px; }
.p2p-orbit { position: relative; height: 190px; }
.p2p-orbit span { position: absolute; border-radius: 50%; border: 1px solid rgba(0,232,135,.42); animation: p2p-orbit 6s linear infinite; }
.p2p-orbit span:nth-child(1) { inset: 20px; }
.p2p-orbit span:nth-child(2) { inset: 52px; animation-duration: 4.8s; animation-direction: reverse; }
.p2p-orbit span:nth-child(3) { width: 48px; height: 48px; left: calc(50% - 24px); top: calc(50% - 24px); background: var(--green); border: 0; box-shadow: 0 0 34px rgba(0,232,135,.52); }
.p2p-filter { display: grid; grid-template-columns: 150px 90px 90px auto; gap: 10px; }
.p2p-offers { display: grid; gap: 14px; }
.p2p-offer { display: grid; grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(110px, .7fr)) minmax(190px, .8fr); gap: 14px; align-items: center; padding: 16px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: var(--panel-soft); }
.p2p-offer span, .p2p-form-grid label { color: var(--muted); font-size: .9rem; }
.p2p-offer strong { display: block; overflow-wrap: anywhere; }
.p2p-take { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.p2p-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.status-pill.pending_payment, .status-pill.paid { background: rgba(255,196,0,.2); color: var(--yellow); }
.status-pill.released { background: rgba(0,232,135,.18); color: var(--green); }
.status-pill.cancelled, .status-pill.disputed { background: rgba(255,96,117,.22); color: #ff6075; }
@keyframes market-pan { from { background-position: 0 0; } to { background-position: 88px 44px; } }
@keyframes trade-pulse { 50% { transform: translateY(-8px) scaleY(1.04); } }
@keyframes candle-rise { 0%, 100% { height: 32%; } 50% { height: 82%; } }
@keyframes p2p-orbit { to { transform: rotate(360deg); } }
.trade-list { display: grid; gap: 14px; }
.trade-list div { display: grid; grid-template-columns: 70px 1fr 80px auto; align-items: center; gap: 12px; padding: 18px; background: var(--panel-soft); border-radius: 12px; }
.trade-list span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.trade-list em, .status-pill { justify-self: start; border-radius: 999px; padding: 5px 12px; font-style: normal; background: rgba(0,232,135,.18); color: var(--green); }
.trade-list em.sell { background: rgba(255,96,117,.22); color: #ff6075; }
.trade-list em.hold { background: rgba(255,196,0,.2); color: var(--yellow); }
.trade-list b { color: var(--green); }
.tree-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto auto auto; gap: 20px; align-items: center; border-radius: 0; margin: -38px -38px 0; padding: 24px 32px; }
.search-box { display: flex; align-items: center; gap: 12px; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 14px; padding: 0 16px; }
.search-box input { flex: 1; height: 52px; background: transparent; border: 0; outline: 0; color: var(--text); }
.leg-volume span { display: block; color: var(--muted); font-size: .8rem; }
.tree-controls, .legend { display: flex; align-items: center; gap: 14px; }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-soft); color: var(--text); }
.legend i { display: inline-block; width: 18px; height: 18px; border-radius: 5px; margin-right: 8px; vertical-align: middle; }
.legend .active { background: var(--green-dark); }
.legend .inactive { background: #4e5b6e; }
.legend .you { background: var(--yellow); }
.tree-stage { height: calc(100vh - 112px); overflow: hidden; min-height: 520px; }
#binaryTree { width: 100%; height: 100%; display: block; }
.tree-details-panel {
    position: fixed;
    left: 280px;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 34px;
    transform: translateY(110%);
    transition: transform .22s ease;
    box-shadow: 0 -18px 40px rgba(0,0,0,.35);
}
.tree-details-panel.open { transform: translateY(0); }
.tree-details-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}
.tree-details-heading h2 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 900;
}
.tree-details-close {
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.4rem;
}
.tree-details-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.tree-detail-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 24px;
    min-height: 122px;
    display: grid;
    align-content: center;
    gap: 8px;
}
.tree-detail-card i {
    color: var(--green);
    font-size: 1.3rem;
}
.tree-detail-card span {
    color: var(--muted);
}
.tree-detail-card strong {
    font-size: 1.35rem;
}
.node-card rect { rx: 14; stroke-width: 3; }
.node-card text { fill: #fff; font-weight: 800; text-anchor: middle; pointer-events: none; }
.node-card .sub { fill: #dbe4ee; font-weight: 650; font-size: 13px; }
.link { stroke: rgba(210,219,235,.45); stroke-width: 3; fill: none; }
.level-box { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: #b95700; margin-right: 14px; font-weight: 900; }
.mini-progress { width: 120px; height: 10px; display: inline-block; margin-left: 10px; }
.status-pill { background: #1b263c; color: var(--muted); font-weight: 800; }
.status-pill.open, .status-pill.approved { background: rgba(0,232,135,.18); color: var(--green); }
.status-pill.pending { background: rgba(255,196,0,.2); color: var(--yellow); }
.status-pill.rejected { background: rgba(255,96,117,.22); color: #ff6075; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-tabs { gap: 10px; }
.admin-tabs .nav-link { color: var(--muted); border: 1px solid var(--border); border-radius: 12px; font-weight: 800; }
.admin-tabs .nav-link.active { background: var(--green); border-color: var(--green); color: #061022; }
.admin-inline-form { display: flex; align-items: center; gap: 10px; }
.admin-search { width: min(320px, 100%); }
.admin-compact-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(140px, .45fr) minmax(150px, .45fr) auto; gap: 12px; align-items: end; }
.admin-users-table .form-control-sm { min-height: 38px; }
.referral-link-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid, .stats-grid.three, .content-grid.two, .ticker-strip, .tree-toolbar { grid-template-columns: 1fr; }
    .admin-compact-form { grid-template-columns: 1fr; }
    .p2p-hero, .p2p-offer { grid-template-columns: 1fr; }
    .p2p-filter { grid-template-columns: 1fr 1fr; }
    .main-content { padding: 24px; }
    .tree-toolbar { margin: -24px -24px 0; }
    .tree-stage { height: 680px; }
    .tree-details-panel { left: 0; }
    .tree-details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-hero, .home-network, .home-access { grid-template-columns: 1fr; min-height: auto; }
    .auth-home { grid-template-columns: 1fr; }
    .auth-hero-panel { min-height: auto; align-items: start; padding-bottom: 28px; }
    .auth-panel { min-height: auto; border-left: 0; border-top: 1px solid var(--border); }
    .compact-home .home-hero, .compact-preview { grid-template-columns: 1fr; }
    .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-chart-card { position: static; margin-top: 16px; }
}

@media (max-width: 640px) {
    body { padding-bottom: 86px; }
    .app-shell {
        display: block;
        min-height: 100vh;
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 70;
        width: 240px;
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
        border-right: 1px solid var(--border);
        border-bottom: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 18px 0 40px rgba(0,0,0,.42);
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 60;
        background: rgba(0,0,0,.45);
        display: none;
    }
    body.sidebar-open .sidebar-backdrop {
        display: block;
    }
    .mobile-menu-toggle {
        position: fixed;
        left: 12px;
        top: 12px;
        z-index: 55;
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: rgba(13, 22, 43, .96);
        color: var(--text);
        font-size: 1.45rem;
    }
    .brand {
        justify-content: flex-start;
        padding: 18px 16px 14px;
        font-size: 1.05rem;
    }
    .brand strong { display: block; }
    .brand-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }
    .profile {
        justify-content: flex-start;
        padding: 14px 16px;
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }
    .avatar {
        width: 46px;
        height: 46px;
        font-size: .9rem;
    }
    .profile > div:not(.avatar) { display: block; }
    .nav-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 8px 16px;
    }
    .nav-list a {
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        min-height: 58px;
        padding: 12px 14px;
        border-radius: 12px;
        font-size: .9rem;
        line-height: 1.1;
        text-align: left;
    }
    .nav-list a i { font-size: 1.18rem; }
    .nav-list a span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-taskbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0;
        background: rgba(8, 15, 34, .98);
        border-top: 1px solid var(--border);
        box-shadow: 0 -12px 30px rgba(0,0,0,.32);
    }
    .mobile-taskbar a {
        min-width: 0;
        height: calc(70px + env(safe-area-inset-bottom));
        display: grid;
        place-items: center;
        align-content: center;
        gap: 3px;
        padding: 8px 3px calc(8px + env(safe-area-inset-bottom));
        font-size: .66rem;
        color: #cbd2df;
        text-align: center;
    }
    .mobile-taskbar a.active {
        background: linear-gradient(135deg, #00f08c, #08ce72);
        color: #061022;
    }
    .mobile-taskbar a i { font-size: 1.25rem; }
    .mobile-taskbar a span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .main-content {
        margin-left: 0;
        padding: 68px 14px 28px;
    }
    .page-title {
        display: block;
        margin-bottom: 18px;
    }
    .page-title h1 {
        font-size: 2rem;
        line-height: 1.08;
        margin-bottom: 8px;
    }
    .page-title p { font-size: .98rem; }
    .panel {
        padding: 18px;
        border-radius: 14px;
        min-width: 0;
    }
    .panel h2 {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }
    .panel-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .stats-grid,
    .stats-grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .stat-card {
        min-height: 126px;
        padding: 16px;
        gap: 6px;
    }
    .stat-card strong {
        font-size: 1.3rem;
        overflow-wrap: anywhere;
    }
    .content-grid.two {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
    .ticker-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 16px;
        gap: 12px;
    }
    .ticker-strip div {
        min-width: 0;
    }
    .ticker-strip strong,
    .ticker-strip span,
    .ticker-strip b {
        overflow-wrap: anywhere;
    }
    .mode-pill {
        margin-top: 14px;
        justify-content: space-between;
        padding: 12px 14px;
        gap: 10px;
    }
    .switch-dot { width: 58px; height: 32px; }
    .switch-dot:after { width: 22px; height: 22px; }
    .notice-bar {
        padding: 16px;
        gap: 12px;
    }
    .notice-bar > div { min-width: 0; }
    .balance-box { padding: 18px 76px 18px 18px; }
    .balance-box strong {
        font-size: 1.6rem;
        overflow-wrap: anywhere;
    }
    .balance-box i {
        width: 48px;
        height: 48px;
        font-size: 1.35rem;
    }
    .rule-list div {
        align-items: flex-start;
        padding: 13px 0;
    }
    .trade-list div {
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 14px;
    }
    .p2p-filter, .p2p-form-grid, .p2p-take { grid-template-columns: 1fr; }
    .p2p-hero { min-height: auto; }
    .p2p-orbit { display: none; }
    .admin-actions form {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    .trade-list span { order: 3; }
    .trade-list em { justify-self: end; }
    .trade-list b { justify-self: end; }
    .tree-toolbar {
        margin: -68px -14px 0;
        padding: 68px 14px 14px;
        grid-template-columns: 1fr;
        gap: 12px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }
    .search-box input { height: 46px; }
    .leg-volume {
        display: inline-grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        background: var(--panel-soft);
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 12px;
        padding: 10px 12px;
    }
    .tree-controls,
    .legend {
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .icon-btn {
        width: 44px;
        height: 44px;
    }
    .tree-stage {
        height: clamp(420px, calc(100vh - 245px), 560px);
        min-height: 420px;
        margin: 0 -14px;
        overflow: hidden;
        touch-action: none;
    }
    .tree-details-panel {
        left: 0;
        right: 0;
        padding: 22px 14px 92px;
        max-height: 55vh;
        overflow-y: auto;
    }
    .tree-details-heading {
        margin-bottom: 16px;
    }
    .tree-details-heading h2 {
        font-size: 1.35rem;
    }
    .tree-details-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .tree-detail-card {
        min-height: 96px;
        padding: 16px;
    }
    .tree-detail-card strong {
        font-size: 1.12rem;
    }
    .referral-link-box {
        grid-template-columns: 1fr;
    }
    #binaryTree {
        width: 100%;
        height: 100%;
        min-width: 0;
        min-height: 420px;
    }
    .node-card text { font-size: 10px; }
    .node-card .sub { font-size: 9px; }
    .link { stroke-width: 2; }
    .table-responsive {
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive .table {
        min-width: 620px;
    }
    .rewards-table th,
    .rewards-table td {
        white-space: nowrap;
    }
    .level-box {
        width: 40px;
        height: 40px;
        margin-right: 8px;
    }
    .mini-progress {
        width: 82px;
    }
    .auth-home {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }
    .auth-panel {
        order: 1;
        min-height: auto;
        border-top: 0;
        padding: 16px 14px 24px;
        place-items: center;
    }
    .auth-card-brand {
        display: flex;
        align-items: center;
    }
    .auth-card-brand strong {
        display: block;
    }
    .auth-card {
        padding: 22px;
    }
    .auth-hero-panel {
        order: 2;
        min-height: 360px;
        padding: 24px 16px 34px;
        align-items: end;
    }
    .auth-hero-bg {
        opacity: .48;
    }
    .auth-hero-content {
        gap: 18px;
    }
    .auth-hero-content .brand strong {
        display: none;
    }
    .auth-hero-content .brand {
        display: none;
    }
    .auth-hero-content h1 {
        font-size: 1.9rem;
    }
    .auth-hero-content p {
        font-size: 1rem;
    }
    .auth-hero-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .auth-preview-image img {
        aspect-ratio: 16 / 9;
    }
    .auth-hero-metrics div {
        padding: 12px 8px;
    }
    .auth-hero-metrics strong {
        font-size: 1.05rem;
    }
    .auth-hero-metrics span {
        font-size: .72rem;
    }
    .auth-panel {
        padding: 18px 14px 28px;
    }
    .home-nav { position: static; align-items: flex-start; }
    .home-nav .brand strong { display: block; }
    .home-nav-actions { display: none; }
    .home-page { padding: 24px 14px 0; }
    .home-hero { gap: 22px; }
    .home-hero h1 { font-size: 2.35rem; }
    .compact-home .home-hero h1 { font-size: 2.15rem; }
    .home-hero p, .section-copy p, .home-network p, .home-access p { font-size: 1rem; line-height: 1.6; }
    .home-metrics, .home-stats, .showcase-grid { grid-template-columns: 1fr; }
    .home-stats { margin-top: 34px; }
    .home-stats article { min-height: auto; }
    .home-showcase, .home-network, .home-access { padding: 34px 0; }
    .home-access { padding: 20px; }
    .compact-access { padding: 0; }
    .compact-preview { padding: 22px 0 34px; }
    .network-flow { display: grid; }
}

@media (max-width: 380px) {
    .stats-grid,
    .stats-grid.three,
    .ticker-strip {
        grid-template-columns: 1fr;
    }
    .nav-list a span {
        display: inline;
    }
    .trade-list div { grid-template-columns: 1fr 1fr; }
    .mobile-taskbar a span { font-size: .58rem; }
    .mobile-taskbar a i { font-size: 1.08rem; }
}
