:root {
    --sidebar-w: 280px;
    --sidebar-w-collapsed: 86px;
    --topbar-h: 72px;
    --page-max: 1360px;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;

    --bg: #070b16;
    --bg-2: #0a1022;
    --surface: rgba(15, 23, 42, .78);
    --surface-strong: rgba(15, 23, 42, .92);
    --surface-soft: rgba(255, 255, 255, .055);
    --border: rgba(148, 163, 184, .18);
    --border-strong: rgba(226, 232, 240, .24);
    --text: #f8fafc;
    --muted: rgba(203, 213, 225, .72);
    --muted-2: rgba(148, 163, 184, .58);
    --accent: #38bdf8;
    --accent-2: #8b5cf6;
    --accent-3: #34d399;
    --danger: #fb7185;
    --warning: #fbbf24;
    --shadow: 0 24px 70px rgba(0, 0, 0, .34);
    --shadow-sm: 0 12px 34px rgba(0, 0, 0, .22);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-rendering: geometricPrecision;
}

body.sidebar-locked {
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(circle at 8% 10%, rgba(56, 189, 248, .18), transparent 30%),
        radial-gradient(circle at 92% 4%, rgba(139, 92, 246, .20), transparent 34%),
        radial-gradient(circle at 48% 100%, rgba(52, 211, 153, .12), transparent 34%),
        linear-gradient(145deg, #070b16 0%, #0b1124 50%, #070b16 100%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.75), transparent 78%);
    pointer-events: none;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

::selection {
    background: rgba(56, 189, 248, .35);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .28) transparent;
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-display {
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    letter-spacing: -.035em;
}

.app-shell {
    min-height: 100vh;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(7, 11, 22, .94));
    border-right: 1px solid var(--border);
    box-shadow: 18px 0 60px rgba(0, 0, 0, .28);
    backdrop-filter: blur(28px) saturate(155%);
    -webkit-backdrop-filter: blur(28px) saturate(155%);
    transition: transform .28s cubic-bezier(.4,0,.2,1), width .24s ease;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: .82rem;
    min-height: var(--topbar-h);
    padding: .95rem 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.brand-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, .26), rgba(139, 92, 246, .20)),
        rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 14px 34px rgba(56,189,248,.12);
    color: #bae6fd;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-title {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: .98rem;
    font-weight: 900;
    line-height: 1.05;
    color: #fff;
}

.brand-subtitle {
    margin-top: .16rem;
    color: var(--muted-2);
    font-size: .72rem;
    font-weight: 600;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: .9rem .82rem;
}

.nav-section + .nav-section {
    margin-top: 1rem;
}

.nav-label {
    padding: .5rem .68rem .42rem;
    font-size: .68rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .12em;
    color: rgba(148, 163, 184, .55);
    text-transform: uppercase;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .72rem;
    min-height: 46px;
    margin: .18rem 0;
    padding: .58rem .68rem;
    border-radius: 15px;
    color: var(--muted);
    font-size: .91rem;
    font-weight: 700;
    text-decoration: none;
    outline: none;
    transition: background .18s ease, color .18s ease, transform .18s ease, border-color .18s ease;
}

.sidebar-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 999px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-3));
    transform: translateY(-50%);
    transition: height .18s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
    color: #fff;
    background: rgba(255,255,255,.075);
    transform: translateX(2px);
}

.sidebar-link.active {
    color: #fff;
    background:
        linear-gradient(135deg, rgba(56,189,248,.16), rgba(139,92,246,.12)),
        rgba(255,255,255,.06);
    border: 1px solid rgba(125, 211, 252, .20);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 24px rgba(56,189,248,.08);
}

.sidebar-link.active::before {
    height: 22px;
}

.nav-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.07);
}

.sidebar-footer {
    padding: .86rem .82rem 1rem;
    border-top: 1px solid var(--border);
}

.coin-card {
    display: flex;
    align-items: center;
    gap: .72rem;
    padding: .78rem .82rem;
    border-radius: 17px;
    background: linear-gradient(135deg, rgba(251,191,36,.13), rgba(56,189,248,.06));
    border: 1px solid rgba(251,191,36,.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}

.coin-card i {
    color: #fde68a;
}

.coin-card strong {
    display: block;
    font-size: .92rem;
    color: #fff;
}

.coin-card span {
    display: block;
    font-size: .72rem;
    color: var(--muted-2);
    margin-top: .05rem;
}

.mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    background: rgba(0, 0, 0, .58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.mobile-backdrop.open {
    display: block;
}

/* =========================
   MAIN LAYOUT
========================= */

.main-wrap {
    min-height: 100vh;
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    transition: margin-left .24s ease;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-w);
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 0 clamp(.85rem, 2vw, 1.45rem);
    background: rgba(7, 11, 22, .68);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(22px) saturate(165%);
    -webkit-backdrop-filter: blur(22px) saturate(165%);
    transition: left .24s ease;
}

.icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 15px;
    background: rgba(255,255,255,.065);
    color: #e2e8f0;
    cursor: pointer;
    text-decoration: none;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
    transform: translateY(-1px);
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.18);
    outline: none;
}

.hamburger {
    display: none;
}

.topbar-title {
    flex: 1;
    min-width: 0;
}

.topbar-kicker {
    color: var(--muted-2);
    font-size: .74rem;
    font-weight: 700;
}

.topbar-name {
    max-width: min(56vw, 640px);
    margin-top: .08rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: clamp(.98rem, 2vw, 1.18rem);
    font-weight: 900;
    color: #fff;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.desktop-pill {
    display: inline-flex;
    align-items: center;
    gap: .48rem;
    min-height: 42px;
    padding: .55rem .82rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: #e2e8f0;
    font-size: .84rem;
    font-weight: 800;
    white-space: nowrap;
}

.desktop-pill i {
    color: #fde68a;
}

.count-badge,
.notification-dot {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #fb7185, #ef4444);
    border: 2px solid #0b1124;
    color: #fff;
    font-size: .62rem;
    font-weight: 900;
    line-height: 1;
}

/* =========================
   USER DROPDOWN
========================= */

.dropdown-wrap {
    position: relative;
}

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    height: 46px;
    max-width: 260px;
    padding: .28rem .72rem .28rem .28rem;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 999px;
    background: rgba(255,255,255,.07);
    color: #e2e8f0;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.user-btn:hover,
.user-btn:focus-visible {
    transform: translateY(-1px);
    background: rgba(255,255,255,.11);
    border-color: rgba(255,255,255,.18);
    outline: none;
}

.avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background:
        linear-gradient(135deg, rgba(56,189,248,.20), rgba(139,92,246,.16)),
        rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.16);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-text {
    min-width: 0;
    text-align: left;
    line-height: 1.08;
}

.user-text strong {
    display: block;
    max-width: 154px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #fff;
    font-size: .84rem;
    font-weight: 900;
}

.user-text span {
    display: block;
    margin-top: .16rem;
    color: var(--muted-2);
    font-size: .68rem;
    font-weight: 700;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(290px, calc(100vw - 24px));
    padding: .56rem;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(15, 23, 42, .96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-7px) scale(.98);
    transition: opacity .16s ease, transform .16s ease;
}

.dropdown-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.dropdown-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .66rem .72rem .86rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .4rem;
}

.dropdown-head strong {
    display: block;
    color: #fff;
    font-size: .92rem;
    font-weight: 900;
}

.dropdown-head span {
    display: block;
    margin-top: .14rem;
    color: var(--muted-2);
    font-size: .74rem;
    font-weight: 700;
}

.dropdown-link,
.dropdown-static {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 42px;
    padding: .58rem .68rem;
    border-radius: 14px;
    color: var(--muted);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 750;
    transition: background .16s ease, color .16s ease;
}

.dropdown-link:hover,
.dropdown-link:focus-visible {
    color: #fff;
    background: rgba(255,255,255,.075);
    outline: none;
}

.dropdown-link i,
.dropdown-static i {
    width: 20px;
    text-align: center;
}

.dropdown-static {
    cursor: default;
}

.dropdown-sep {
    height: 1px;
    margin: .42rem .2rem;
    background: var(--border);
}

.logout-link {
    color: #fecdd3;
}

.login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .52rem;
    min-height: 42px;
    padding: .58rem 1rem;
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 900;
    background: linear-gradient(135deg, rgba(56,189,248,.92), rgba(139,92,246,.88));
    box-shadow: 0 16px 38px rgba(56,189,248,.18);
    transition: transform .18s ease, box-shadow .18s ease;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 48px rgba(56,189,248,.24);
}

/* =========================
   CONTENT
========================= */

.messages-wrap,
.content-container,
.footer-outer {
    width: min(var(--page-max), calc(100% - clamp(1.4rem, 4vw, 3rem)));
    margin-inline: auto;
}

.messages-wrap {
    padding-top: 1rem;
}

.msg-bar {
    display: flex;
    align-items: flex-start;
    gap: .72rem;
    margin-bottom: .58rem;
    padding: .82rem .95rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.msg-bar.success {
    background: rgba(52,211,153,.09);
    border-color: rgba(52,211,153,.22);
}

.msg-bar.error {
    background: rgba(251,113,133,.09);
    border-color: rgba(251,113,133,.22);
}

.msg-bar.warning {
    background: rgba(251,191,36,.09);
    border-color: rgba(251,191,36,.22);
}

.msg-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: rgba(255,255,255,.075);
}

.msg-bar p {
    margin: 0;
    padding-top: .22rem;
    color: #e2e8f0;
    font-size: .88rem;
    line-height: 1.45;
}

.main-content {
    min-height: calc(100vh - var(--topbar-h) - 80px);
    padding-block: clamp(1.25rem, 2.6vw, 2.35rem);
}

.footer-outer {
    padding-bottom: 1.25rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: .88rem 1rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    color: var(--muted-2);
    font-size: .8rem;
    font-weight: 650;
}

/* =========================
   REUSABLE UI CLASSES
========================= */

.gradient-text {
    color: transparent;
    background: linear-gradient(90deg, #7dd3fc, #c4b5fd, #6ee7b7);
    -webkit-background-clip: text;
    background-clip: text;
}

.glass,
.glass-strong,
.liquid-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,.06);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(22px) saturate(165%);
    -webkit-backdrop-filter: blur(22px) saturate(165%);
}

.glass-strong {
    background: rgba(255,255,255,.085);
    border-color: var(--border-strong);
}

.liquid-card {
    position: relative;
    overflow: hidden;
}

.liquid-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,.14), transparent 34%, rgba(255,255,255,.04));
}

.liquid-card > * {
    position: relative;
    z-index: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    padding: .4rem .7rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.07);
    color: rgba(241,245,249,.92);
    font-size: .78rem;
    font-weight: 850;
}

.btn-liquid,
.btn-soft,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .54rem;
    min-height: 42px;
    padding: .72rem 1.06rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.16);
    color: #fff;
    text-decoration: none;
    font-weight: 900;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn-liquid {
    background: linear-gradient(135deg, rgba(56,189,248,.94), rgba(139,92,246,.90));
    box-shadow: 0 16px 42px rgba(56,189,248,.18);
}

.btn-soft {
    background: rgba(255,255,255,.075);
}

.btn-danger {
    background: linear-gradient(135deg, rgba(248,113,113,.96), rgba(244,63,94,.92));
    box-shadow: 0 16px 42px rgba(244,63,94,.18);
}

.btn-liquid:hover,
.btn-soft:hover,
.btn-danger:hover {
    transform: translateY(-1px);
}

.btn-soft:hover {
    background: rgba(255,255,255,.12);
}

.input-liquid {
    width: 100%;
    min-height: 44px;
    padding: .78rem .92rem;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,.13);
    background: rgba(255,255,255,.075);
    color: #fff;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.input-liquid:focus {
    border-color: rgba(56,189,248,.72);
    box-shadow: 0 0 0 4px rgba(56,189,248,.14);
    background: rgba(255,255,255,.10);
}

.input-liquid::placeholder {
    color: rgba(203,213,225,.48);
}

.input-liquid option {
    color: #0f172a;
    background: #fff;
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 40px;
    padding: .62rem .94rem;
    border-radius: 999px;
    color: rgba(226,232,240,.90);
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    text-decoration: none;
    font-weight: 850;
    transition: transform .18s ease, background .18s ease;
}

.topbar-link:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
    transform: translateY(-1px);
}

/* =========================
   COLLAPSED SIDEBAR FIX
========================= */

@media (min-width: 1180px) {
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-w-collapsed);
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .nav-label,
    body.sidebar-collapsed .coin-card div {
        display: none;
    }

    body.sidebar-collapsed .brand {
        justify-content: center;
        padding-inline: .7rem;
    }

    body.sidebar-collapsed .sidebar-scroll {
        padding-inline: .7rem;
    }

    body.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding-inline: .48rem;
        gap: 0;
    }

    body.sidebar-collapsed .sidebar-link > span:not(.nav-icon) {
        display: none;
    }

    body.sidebar-collapsed .sidebar-link .nav-icon {
        display: inline-flex;
        margin: 0;
    }

    body.sidebar-collapsed .coin-card {
        justify-content: center;
        padding-inline: .4rem;
    }

    body.sidebar-collapsed .coin-card i {
        display: inline-flex;
    }

    body.sidebar-collapsed .main-wrap {
        margin-left: var(--sidebar-w-collapsed);
    }

    body.sidebar-collapsed .topbar {
        left: var(--sidebar-w-collapsed);
    }
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1179px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
    }

    .main-wrap {
        margin-left: 0;
    }

    .hamburger {
        display: inline-flex;
    }
}

@media (max-width: 760px) {
    :root {
        --topbar-h: 66px;
    }

    .topbar {
        gap: .62rem;
    }

    .topbar-kicker {
        display: none;
    }

    .topbar-name {
        font-size: .98rem;
        max-width: 42vw;
    }

    .desktop-pill {
        display: none;
    }

    .user-text {
        display: none;
    }

    .user-btn {
        width: 44px;
        height: 44px;
        padding: .25rem;
        justify-content: center;
    }

    .user-btn .fa-chevron-down {
        display: none;
    }

    .avatar {
        width: 36px;
        height: 36px;
    }

    .messages-wrap,
    .content-container,
    .footer-outer {
        width: min(100% - 1rem, var(--page-max));
    }

    .main-content {
        padding-block: 1rem;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 460px) {
    .topbar {
        padding-inline: .62rem;
    }

    .icon-btn {
        width: 39px;
        height: 39px;
        border-radius: 13px;
    }

    .topbar-name {
        max-width: 35vw;
    }

    .sidebar {
        width: min(88vw, var(--sidebar-w));
    }

    .brand {
        padding-inline: .85rem;
    }

    .sidebar-scroll {
        padding-inline: .65rem;
    }

    .sidebar-footer {
        padding-inline: .65rem;
    }
}

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

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