/* ==========================================================================
   3. ГЛАВНАЯ СТРУКТУРА И НАВИГАЦИЯ (LAYOUT)
   ========================================================================== */
#app-screen {
    display: flex;
    width: 100%;
    height: 100%;
}

.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.content-area {
    padding: 32px;
    overflow-y: auto;
    /* overflow-x: hidden убран — он создавал stacking context, блокируя z-index fixed-модалок */
    flex-grow: 1;
    position: relative;
    min-width: 0;
}

/* Боковое меню */
.sidebar {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    /* Всегда темное (цвета лежат в theme.css) */
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    color: #38bdf8;
}

.nav-menu {
    flex-grow: 1;
    padding-top: 15px;
}

.nav-item {
    padding: 14px 24px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: #94a3b8;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #38bdf8;
    border-right: 4px solid #38bdf8;
}

.nav-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 20px;
}

/* Верхняя панель */
.topbar {
    background: var(--card-bg);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.user-info {
    font-weight: 600;
    color: var(--text-main);
}

/* Логика переключения модулей */
.module {
    display: none;
}

.module.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease forwards;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content-area {
        padding: 15px;
    }
}

/* ==========================================================================
   9. КНОПКА СКРОЛЛА
   ========================================================================== */
#scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    background-color: var(--primary);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scroll-top-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
}

/* DEV PANEL */
.btn-dev-danger {
    background: #333 !important;
    color: white !important;
    border: 1px solid #555 !important;
}

.btn-dev-danger:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

body.dev-mode-active {
    padding-bottom: 60px !important;
}

/* ==========================================================================
   СКВОЗНАЯ НАВИГАЦИЯ (ENTITY LINKS)
   ========================================================================== */
.entity-link {
    cursor: pointer;
    transition: all 0.1s ease-in-out;
    /* Ультра-быстрая анимация */
    display: inline-block;
    color: var(--text-main);
    /* В покое цвет текста */
    text-decoration: none !important;
    /* Гарантируем отсутствие подчеркивания */
}

.entity-link:hover {
    color: var(--primary) !important;
    /* Цвет твоей темы при наведении */
    transform: scale(1.03);
    /* Очень легкое, элегантное масштабирование вверх */
    text-decoration: none !important;
    /* Убираем любые подчеркивания навсегда */
}

/* Скрытие системной стрелки для кастомных Combobox (datalist) */
input[list]::-webkit-calendar-picker-indicator {
    display: none !important;
    opacity: 0;
}

.dev-panel-hidden {
    display: none !important;
}

body.dev-panel-hidden-active {
    padding-bottom: 0 !important;
}

/* ==========================================================================
   UTILITY CLASSES & AUDIT-011 
   ========================================================================== */
.hidden {
    display: none !important;
}
