.gex-body {
    height: 100vh;
    height: 100dvh; /* мобильные браузеры */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gex-layout {
    flex: 1;
    min-height: 0;          /* важно для flex-детей */
    display: flex;
    overflow: hidden;
}

.gex-sidebar {
    width: 300px;
    background: #0e0e16;
    border-right: 1px solid #1e1e2e;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gex-section h3 {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.gex-section > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gex-btn {
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    color: #888;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.gex-btn:hover {
    background: #252538;
    color: #ccc;
}

.gex-btn.active {
    background: #2a1a3e;
    border-color: #a855f7;
    color: #a855f7;
}

#gex-expiration-select {
    width: 100%;
    background: #1a1a28;
    border: 1px solid #2a2a3a;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.gex-generate-btn {
    width: 100%;
    background: #22c55e;
    border: 1px solid #22c55e;
    color: #0a0a0f;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.gex-generate-btn:hover {
    background: #16a34a;
}

.gex-generate-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.gex-status {
    color: #666;
    font-size: 11px;
    text-align: center;
}

.gex-main {
    flex: 1;
    min-height: 0;
    padding: 20px;
    overflow: hidden;       /* скролл будет у chart-wrapper */
    display: flex;
    flex-direction: column;
}

.gex-info-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.gex-card {
    background: #0e0e16;
    border: 1px solid #1e1e2e;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 130px;
}

.gex-card-label {
    color: #666;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.gex-card-value {
    color: #fff;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 16px;
    font-weight: 600;
}

.gex-chart-wrapper {
    flex: 1;
    min-height: 0;
    background: #0a0a0f;
    border: 1px solid #1e1e2e;
    border-radius: 8px;
    padding: 16px;
    position: relative;
    overflow: auto;         /* если график выше — скролл внутри модуля профиля */
}

.gex-empty-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #444;
    font-size: 14px;
    text-align: center;
}

@media (max-width: 768px) {
    /* Разрешаем скролл всей страницы */
    .gex-body {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: auto; 
    }

    /* Убираем ограничение высоты и внутренний скролл */
    .gex-layout {
        flex-direction: column;
        overflow: visible;
        height: auto;
    }

    /* Сайдбар (Модуль выбора) */
    .gex-sidebar {
        width: 100%;
        max-height: none;       
        flex: 0 0 auto;         
        padding: 12px;
        gap: 10px;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid #1e1e2e;
    }

    .gex-section h3 {
        margin-bottom: 6px;
    }

    .gex-generate-btn {
        padding: 10px;
        font-size: 13px;
    }

    /* Информационные карточки */
    .gex-info-cards {
        gap: 6px;
        margin-bottom: 10px;
        flex-shrink: 0;
    }
    .gex-card {
        min-width: auto;
        flex: 1 1 calc(50% - 6px);
        padding: 6px 8px;
    }
    .gex-card-label {
        font-size: 9px;
        margin-bottom: 2px;
    }
    .gex-card-value {
        font-size: 12px;
    }

    /* Главная область (Профиль) */
    .gex-main {
        flex: none;             /* Убираем жесткий flex */
        height: auto;
        min-height: auto;       
        padding: 8px;
        overflow: visible;      /* Позволяем графику выходить вниз */
        display: flex;
        flex-direction: column;
    }

    /* Контейнер графика */
    .gex-chart-wrapper {
        height: auto;           /* Высота будет управляться через JS (style.height) */
        min-height: 500px;
        padding: 8px 8px 45px 8px !important; /* 45px снизу, чтобы шкала X и её подписи не резались */
        overflow: visible;      /* Скролл идет по всей странице, а не внутри маленького окна */
    }
}