/* Shared mobile shell for every base template.
   Below 992px the sidebar becomes an off-canvas drawer and a slim top bar
   (injected by shell-responsive.js) takes its place.
   Selectors are prefixed with .app-shell so they beat the old inline
   @media block in each base regardless of load order. */

.mobile-topbar,
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    /* Top bar */
    .app-shell .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex-shrink: 0;
        height: 56px;
        padding: 0 0.75rem;
        background-color: var(--sidebar-bg, #11161c);
        color: var(--sidebar-text, #e9ecef);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .mobile-topbar-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        border-radius: 0.5rem;
        color: inherit;
        font-size: 1.5rem;
        line-height: 1;
    }
    .mobile-topbar-btn:hover,
    .mobile-topbar-btn:focus-visible { background-color: rgba(255, 255, 255, 0.08); }
    .mobile-topbar-logo { max-height: 28px; width: auto; flex-shrink: 0; }
    .mobile-topbar-title {
        margin-left: auto;
        font-size: 0.9rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Sidebar -> drawer */
    .app-shell .app-sidebar,
    .app-shell .app-sidebar.collapsed {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
        width: 270px;
        max-width: 85vw;
        padding: 1rem 0.75rem;
        flex-direction: column;
        align-items: stretch;
        overflow: hidden;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .app-shell .app-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 0 0 32px rgba(0, 0, 0, 0.5);
    }
    .app-shell .sidebar-toggle-btn { display: none; }
    .app-shell .sidebar-logo { margin-left: 0; }

    .app-shell .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }
    .app-shell .sidebar-backdrop.show { opacity: 1; visibility: visible; }

    /* Main area */
    .app-shell .app-main { min-height: 0; }
    .app-shell .app-content { padding: 1rem; }
}