.app-shell {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #f4f6f9;
    color: #111827;
}

.app-sidebar {
    z-index: 30;
    display: flex;
    flex: 0 0 260px;
    width: 260px;
    min-height: 0;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
    background: #111827;
    color: #ffffff;
}

.cabinet-sidebar-shell {
    display: flex;
    min-height: 100%;
    flex: 1 1 auto;
    flex-direction: column;
}

.cabinet-sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cabinet-brand-link {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #ffffff;
    text-decoration: none;
}

.cabinet-brand-link:hover {
    color: #ffffff;
}

.cabinet-brand-logo {
    display: inline-flex;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.cabinet-brand-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.cabinet-brand-content strong {
    font-size: 18px;
    line-height: 1.2;
}

.cabinet-brand-content small {
    margin-top: 4px;
    color: #9ca3af;
    font-size: 12px;
}

.cabinet-sidebar-navigation {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 5px;
    padding: 22px 14px;
}

.cabinet-nav-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cabinet-sidebar-link {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 13px;
    padding: 9px 12px;
    border-radius: 11px;
    color: #d1d5db;
    text-decoration: none;
}

.cabinet-sidebar-link:hover,
.cabinet-sidebar-link.is-active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.cabinet-sidebar-link.is-active {
    font-weight: 600;
}

.cabinet-sidebar-group-summary {
    list-style: none;
    cursor: pointer;
}

.cabinet-sidebar-group-summary::-webkit-details-marker {
    display: none;
}

.cabinet-sidebar-marker {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

.cabinet-sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cabinet-sidebar-chevron {
    margin-left: auto;
    color: #9ca3af;
    font-size: 13px;
}

.cabinet-nav-children {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 20px;
}

.cabinet-sidebar-child-link {
    min-height: 42px;
}

.cabinet-sidebar-footer {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #d1d5db;
}

.cabinet-admin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    text-decoration: none;
}

.cabinet-admin-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.cabinet-sidebar-footer span {
    font-size: 13px;
    font-weight: 600;
}

.cabinet-sidebar-footer small {
    color: #6b7280;
    font-size: 11px;
}

.cabinet-miniheader-title h1 {
    margin: 0;
    font-size: 23px;
    font-weight: 700;
}

.cabinet-miniheader-title p {
    margin: 5px 0 0;
    color: #6b7280;
    font-size: 13px;
}

.app-workspace {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
}

.app-subheader {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 28px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
}

.app-subheader-main {
    min-width: 0;
}

.app-breadcrumbs {
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 13px;
}

.app-breadcrumbs a {
    color: inherit;
    text-decoration: none;
}

.app-breadcrumbs a:hover {
    color: #111827;
    text-decoration: underline;
}

.app-page-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-height: 42px;
}

.app-messages {
    padding: 20px 28px 0;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 28px;
}

.cabinet-mobile-topbar,
.cabinet-mobile-menu {
    display: none;
}

@media (max-width: 1050px) {
    .app-sidebar {
        flex-basis: 230px;
        width: 230px;
    }

    .app-subheader,
    .app-messages,
    .app-content {
        padding-right: 22px;
        padding-left: 22px;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        width: 100%;
        overflow: hidden;
    }

    .app-sidebar {
        display: none;
    }

    .app-workspace {
        width: 100%;
        min-width: 0;
    }

    .cabinet-mobile-topbar {
        display: flex;
        min-height: 56px;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 12px;
        border-bottom: 1px solid #e5e7eb;
        background: #ffffff;
    }

    .cabinet-mobile-menu-toggle,
    .cabinet-mobile-menu__close {
        display: inline-flex;
        width: 44px;
        min-width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 0;
        border-radius: 10px;
        background: #111827;
        color: #ffffff;
        font-size: 22px;
        line-height: 1;
    }

    .cabinet-mobile-topbar__brand {
        overflow: hidden;
        color: #111827;
        font-size: 16px;
        font-weight: 800;
        letter-spacing: .03em;
        text-decoration: none;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cabinet-mobile-topbar__role {
        min-width: 44px;
        color: #6b7280;
        font-size: 12px;
        text-align: right;
    }

    .cabinet-mobile-menu[hidden] {
        display: none;
    }

    .cabinet-mobile-menu.is-open {
        position: fixed;
        z-index: 1000;
        display: block;
        inset: 0;
    }

    .cabinet-mobile-menu__overlay {
        position: absolute;
        inset: 0;
        background: rgba(17, 24, 39, .52);
    }

    .cabinet-mobile-menu__drawer {
        position: relative;
        z-index: 1;
        display: flex;
        width: min(320px, calc(100vw - 24px));
        height: 100%;
        flex-direction: column;
        overflow-y: auto;
        background: #111827;
        box-shadow: 16px 0 36px rgba(17, 24, 39, .28);
        outline: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .cabinet-mobile-menu.is-open .cabinet-mobile-menu__drawer {
        transform: translateX(0);
    }

    .cabinet-mobile-menu__header {
        display: flex;
        min-height: 56px;
        align-items: center;
        justify-content: space-between;
        padding: 6px 12px 6px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, .12);
        color: #ffffff;
        font-size: 14px;
        font-weight: 700;
    }

    .cabinet-mobile-menu__close {
        background: rgba(255, 255, 255, .12);
    }

    .cabinet-mobile-menu__drawer .cabinet-sidebar-shell {
        min-height: 0;
    }

    body.cabinet-mobile-menu-open {
        overflow: hidden;
    }

    .app-subheader {
        position: static;
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 16px 12px;
    }

    .app-page-actions {
        width: 100%;
        min-height: 0;
        justify-content: flex-start;
    }

    .app-page-actions > * {
        max-width: 100%;
    }

    .app-messages {
        padding: 12px 12px 0;
    }

    .app-content {
        padding: 16px 12px 24px;
        overflow-x: hidden;
    }

    .cabinet-preview-banner {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .cabinet-preview-banner button {
        min-height: 44px;
    }

    .app-content img,
    .app-content svg,
    .app-content video,
    .app-content canvas {
        max-width: 100%;
        height: auto;
    }

    .app-content input,
    .app-content select,
    .app-content textarea {
        max-width: 100%;
    }

    .app-content .js-math,
    .app-content mjx-container[display="true"],
    .app-content .katex-display {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .app-content table {
        max-width: 100%;
    }
}
