html, body {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.app-sidebar {
    width: 16rem;
    max-width: 88vw;
    z-index: 45;
    transition: transform 0.2s ease;
}

.nav-reopen {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 35;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.nav-backdrop {
    display: none;
}

@media (max-width: 1023px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-110%);
    }
    body.nav-open > .app-sidebar {
        transform: translateX(0);
    }
    body:not(.nav-open) > .nav-reopen {
        display: flex;
    }
    body:not(.nav-open) > main {
        padding-top: 3.4rem !important;
    }
    .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(2, 6, 23, 0.62);
    }
    body.nav-open > .nav-backdrop {
        display: block;
    }
    #global-filters-panel {
        width: min(24rem, 100%) !important;
    }
}

@media (min-width: 1024px) {
    body.nav-collapsed > .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-110%);
        pointer-events: none;
    }
    body.nav-collapsed > .nav-reopen {
        display: flex;
    }
    body.nav-collapsed > main {
        padding-left: 4rem !important;
    }
}

main {
    overflow: hidden !important;
}

.view-section.hidden {
    display: none !important;
}

.view-section.pane-view:not(.hidden),
.view-section.view-fill:not(.hidden) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.pane-grid {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    gap: 1rem;
    overflow: hidden;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: minmax(0, 1fr);
}

@media (min-width: 1280px) {
    .pane-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1.2fr);
        grid-auto-rows: minmax(0, 1fr);
    }
    .pane-grid.cols-2 {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    }
    .pane-grid.cols-analysis {
        grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
    }
}

.app-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 0.75rem;
}

.app-pane-head {
    flex-shrink: 0;
    padding: 0.85rem 1rem 0.7rem;
    border-bottom: 1px solid #1e293b;
}

.app-pane-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

#view-dashboard {
    min-width: 0;
}

#view-models:not(.hidden) .models-layout,
#view-database:not(.hidden) .admin-layout {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
