*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --wg-sidebar: 248px;
    --wg-blue: #1677d2;
    --wg-blue-dark: #0f5eb0;
    --wg-navy: #0a1f34;
    --wg-navy-2: #0d2944;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.wg-shell-menu {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--wg-sidebar);
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--wg-navy), var(--wg-navy-2));
    color: #fff;
    box-shadow: 8px 0 30px rgba(4,22,38,.14);
    transition: width .22s ease, transform .22s ease;
}

.wg-shell-brand {
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 44px 18px 10px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    position: relative;
}

.wg-shell-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background: #35a7ff;
    box-shadow: 0 0 0 5px rgba(53,167,255,.13);
}

.wg-shell-brand-text {
    font-size: 15px;
    font-weight: 850;
    letter-spacing: .4px;
}

.wg-shell-collapse {
    position: absolute;
    right: 9px;
    top: 17px;
    width: 30px;
    height: 30px;
    border: 1px solid #cbd9e5;
    border-radius: 50%;
    background: #fff;
    color: #27445d;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
    z-index: 10002;
    font-size: 18px;
    line-height: 26px;
}

.wg-shell-label {
    padding: 16px 10px 7px;
    color: #8ea5b9;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.wg-shell-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wg-shell-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    color: #dce8f2;
    font-size: 12px;
    font-weight: 650;
    transition: .16s ease;
}

.wg-shell-nav a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.wg-shell-nav a.active {
    background: linear-gradient(90deg, var(--wg-blue), var(--wg-blue-dark));
    color: #fff;
    box-shadow: 0 7px 18px rgba(0,80,170,.28);
}

.wg-shell-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #bcd3e6;
    font-size: 9px;
    font-weight: 900;
}

.wg-shell-nav a.active .wg-shell-icon {
    background: rgba(255,255,255,.16);
    color: #fff;
}

body.wg-shell-collapsed {
    padding-left: 76px !important;
}

body.wg-shell-collapsed .wg-shell-menu {
    width: 76px;
}

body.wg-shell-collapsed .wg-shell-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.wg-shell-collapsed .wg-shell-brand-text,
body.wg-shell-collapsed .wg-shell-label,
body.wg-shell-collapsed .wg-shell-text {
    display: none;
}

body.wg-shell-collapsed .wg-shell-nav a {
    justify-content: center;
    padding: 0;
}

body.wg-shell-collapsed .wg-shell-collapse {
    right: 9px;
    font-size: 0;
}

body.wg-shell-collapsed .wg-shell-collapse::after {
    content: "›";
    font-size: 20px;
}

.wg-mobile-menu-btn,
.wg-mobile-overlay {
    display: none;
}

@media (max-width: 900px) {

    body {
        padding-left: 0 !important;
    }

    .wg-shell-menu {
        width: min(310px, 88vw);
        transform: translateX(-105%);
        border-radius: 0 18px 18px 0;
    }

    body.wg-mobile-nav-open .wg-shell-menu {
        transform: translateX(0);
    }

    .wg-mobile-menu-btn {
        display: flex;
        position: fixed;
        left: 12px;
        top: 12px;
        z-index: 10001;
        width: 38px;
        height: 38px;
        align-items: center;
        justify-content: center;
        border: 1px solid #d6e1ea;
        border-radius: 9px;
        background: #fff;
        color: #173b5c;
        font-size: 19px;
        box-shadow: 0 5px 16px rgba(20,50,80,.14);
        cursor: pointer;
    }

    .wg-mobile-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: rgba(5,21,35,.42);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: .2s ease;
    }

    body.wg-mobile-nav-open .wg-mobile-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    body.wg-shell-collapsed .wg-shell-menu {
        width: min(310px, 88vw);
    }

    body.wg-shell-collapsed .wg-shell-brand-text,
    body.wg-shell-collapsed .wg-shell-label,
    body.wg-shell-collapsed .wg-shell-text {
        display: block;
    }

    body.wg-shell-collapsed .wg-shell-nav a {
        justify-content: flex-start;
        padding: 0 10px;
    }
}

/* Python Control integration */
body.wg-shell-collapsed .main {
    margin-left: 76px !important;
}

@media (max-width: 900px) {
    .main {
        margin-left: 0 !important;
    }
}

/* Wall Gravity legacy market selector */
.wg-market-selector {
    margin: 12px 0 16px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 9px;
    box-shadow: 0 1px 4px rgba(15,23,42,.06);
}

.wg-market-selector-title {
    margin-bottom: 7px;
    color: #718096;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.wg-market-selector-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wg-market-selector select {
    min-width: 180px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cbd5df;
    border-radius: 7px;
    background: #fff;
    color: #172b3d;
    font-size: 12px;
    font-weight: 700;
}

.wg-market-current {
    padding: 7px 10px;
    border-radius: 7px;
    background: #eef6ff;
    color: #0a6ed1;
    font-size: 11px;
    font-weight: 800;
}

@media (max-width: 600px) {
    .wg-market-selector-row {
        flex-wrap: wrap;
    }

    .wg-market-selector select {
        width: 100%;
        min-width: 0;
    }
}

/* =========================================================
   WALLGRAVITY SHELL - FINAL OVERFLOW / DRAWER POLISH
   Presentation only - no application logic
   ========================================================= */

.wg-shell-menu,
.wg-shell-menu * {
    box-sizing: border-box;
}

.wg-shell-menu {
    max-width: 100vw;
    overscroll-behavior: contain;
}

.wg-shell-nav {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.wg-shell-nav a {
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wg-shell-brand {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.wg-shell-brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-shell-collapse {
    right: 10px !important;
    left: auto !important;
    z-index: 20;
}

@media (max-width: 900px) {
    .wg-shell-menu {
        width: min(248px, 85vw) !important;
        max-width: 85vw !important;
        overflow-x: hidden !important;
    }

    .wg-shell-nav {
        overflow-x: hidden !important;
    }

    .wg-shell-nav a {
        width: calc(100% - 16px);
        max-width: calc(100% - 16px);
    }

    .wg-shell-collapse {
        right: 8px !important;
    }

    html,
    body {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
}

@media (min-width: 901px) {
    body {
        overflow-x: hidden !important;
    }
}

