.pg-app {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pg-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.pg-sidebar {
    width: var(--pg-sidebar-width);
    flex: 0 0 var(--pg-sidebar-width);
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--pg-surface);
    border-right: 1px solid var(--pg-border);
}

.pg-main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pg-topbar {
    position: relative;
    height: var(--pg-topbar-height);
    min-height: var(--pg-topbar-height);
    flex: 0 0 var(--pg-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--pg-surface);
    border-bottom: 1px solid var(--pg-border);
}

.pg-topbar-left,
.pg-topbar-right {
    display: flex;
    align-items: center;
}

.pg-topbar-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pg-page-context {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: var(--pg-font-size-md);
    font-weight: 600;
}

.pg-intelligence-placeholder {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--pg-border);
    border-radius: 999px;
    background: var(--pg-surface-muted);
    color: var(--pg-text-muted);
    font-size: var(--pg-font-size-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    opacity: 0.72;
    cursor: not-allowed;
}

.pg-intelligence-placeholder:disabled {
    opacity: 0.72;
}

.pg-intelligence-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--pg-border);
    border-radius: 50%;
    background: var(--pg-surface);
    color: var(--pg-text-secondary);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0;
}

.pg-intelligence-label {
    white-space: nowrap;
}

.pg-page-context-label {
    color: var(--pg-text);
}

.pg-page-context-separator {
    color: var(--pg-text-muted);
    font-weight: 400;
}

.pg-page-context-system {
    color: var(--pg-text-muted);
    font-size: var(--pg-font-size-xs);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.pg-workspace {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.pg-footer {
    height: var(--pg-footer-height);
    min-height: var(--pg-footer-height);
    flex: 0 0 var(--pg-footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--pg-surface);
    border-top: 1px solid var(--pg-border);
    color: var(--pg-text-muted);
    font-size: var(--pg-font-size-xs);
}


/* Sidebar */

.pg-sidebar-brand {
    height: var(--pg-topbar-height);
    min-height: var(--pg-topbar-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid var(--pg-border);
    font-weight: 700;
    font-size: 17px;
}

.pg-sidebar-logo {
    width: 100px;
    height: 36px;
    object-fit: cover;
    object-position: center;
}

.pg-navigation {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.pg-navigation-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pg-navigation-label {
    padding: 10px 12px 7px;
    color: var(--pg-text-muted);
    font-size: var(--pg-font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pg-navigation-divider {
    height: 1px;
    background: var(--pg-border-light);
    margin: 16px 8px;
}

.pg-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: var(--pg-radius-sm);
    color: var(--pg-text-secondary);
    text-decoration: none;
    font-size: var(--pg-font-size-md);
    transition:
        background var(--pg-transition-fast),
        color var(--pg-transition-fast);
}

.pg-nav-item:hover {
    background: var(--pg-surface-muted);
    color: var(--pg-text);
}

.pg-nav-item.is-active {
    background: #eff6ff;
    color: var(--pg-primary);
    font-weight: 600;
}

.pg-nav-icon {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
    flex: 0 0 18px;
}

.pg-nav-item-future {
    opacity: 0.55;
}

.pg-sidebar-bottom {
    flex: 0 0 auto;
    padding: 14px 20px;
    border-top: 1px solid var(--pg-border-light);
}

.pg-sidebar-version {
    color: var(--pg-text-muted);
    font-size: var(--pg-font-size-xs);
}


/* User area */

.pg-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pg-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--pg-primary);
    font-size: var(--pg-font-size-sm);
    font-weight: 600;
}

.pg-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pg-user-details strong {
    font-size: var(--pg-font-size-sm);
}

.pg-user-details span {
    color: var(--pg-text-muted);
    font-size: var(--pg-font-size-xs);
}


/* Footer */

.pg-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-footer-separator {
    opacity: 0.5;
}


/* Mobile menu */

.pg-mobile-menu {
    display: none;
    border: 0;
    background: transparent;
    margin-right: 10px;
    font-size: 20px;
}


/* Loading screen */

.pg-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pg-surface);
    transition: opacity 220ms ease;
}

.pg-loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.pg-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.pg-loader-logo {
    width: 54px;
    height: 54px;
}

.pg-loader-text {
    color: var(--pg-text-secondary);
    font-size: var(--pg-font-size-sm);
}

.pg-mobile-nav {
    display: none;
}


/* Mobile */

@media (max-width: 900px) {

    .pg-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1000;
        width: var(--pg-sidebar-width);
        height: 100vh;
        transform: translateX(-100%);
        transition: transform var(--pg-transition-normal);
        box-shadow: var(--pg-shadow-md);
    }

    .pg-sidebar.is-open {
        transform: translateX(0);
    }

    .pg-mobile-menu {
        display: block;
    }

    /* =========================================================
   MOBILE NAVIGATION
   ========================================================= */

    .pg-topbar {
        padding: 0 16px;
    }

    .pg-footer {
        padding: 0 14px;
    }

    .pg-footer-right {
        display: none;
    }

    .pg-user-details {
        display: none;
    }

    .pg-page-context-system,
    .pg-page-context-separator {
    display: none;
}

.pg-intelligence-label {
    display: none;
}

.pg-intelligence-placeholder {
    min-width: 34px;
    width: 34px;
    justify-content: center;
    padding: 0;
}

.pg-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    height: 62px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: stretch;
    background: var(--pg-surface);
    border-top: 1px solid var(--pg-border);
    box-shadow: 0 -2px 10px rgba(16, 24, 40, 0.04);
    padding-bottom: env(safe-area-inset-bottom);
}

.pg-mobile-nav-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0;
    background: transparent;
    color: var(--pg-text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
}

.pg-mobile-nav-item:hover {
    color: var(--pg-text);
    background: var(--pg-surface-muted);
}

.pg-mobile-nav-item.is-active {
    color: var(--pg-primary);
    font-weight: 600;
}

.pg-mobile-nav-icon {
    width: 18px;
    height: 18px;
}

.pg-mobile-nav-item span {
    line-height: 1;
}

.pg-workspace {
    padding-bottom: 62px;
}

.pg-footer {
    display: none;
}

}

/* =========================================================
   MOBILE MORE NAVIGATION
   New component — isolated styles
   ========================================================= */

.pg-mobile-more-panel {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.pg-mobile-more-panel__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
}

.pg-mobile-more-panel__sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 62px;
    padding: 18px;
    background: var(--pg-surface);
    border-top: 1px solid var(--pg-border);
    border-radius: 18px 18px 0 0;
    box-shadow: var(--pg-shadow-lg);
}

.pg-mobile-more-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.pg-mobile-more-panel__header h3 {
    margin: 0;
    font-size: var(--pg-font-size-lg);
}

.pg-mobile-more-panel__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--pg-text-secondary);
    font-size: 24px;
    cursor: pointer;
}

.pg-mobile-more-panel__links {
    display: grid;
    gap: 6px;
}

.pg-mobile-more-panel__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--pg-text);
    text-decoration: none;
    font-size: var(--pg-font-size-sm);
}

.pg-mobile-more-panel__link:hover {
    background: var(--pg-surface-muted);
}

.pg-mobile-more-panel__icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.pg-mobile-more-panel__link--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

@media (min-width: 901px) {

    .pg-mobile-more-panel {
        display: none !important;
    }

}

/* Logout */

.pg-logout-form {
    margin-left: 14px;
}

.pg-logout-button {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius-sm);
    background: var(--pg-surface);
    color: var(--pg-text-secondary);
    font: inherit;
    font-size: var(--pg-font-size-xs);
    font-weight: 600;
    cursor: pointer;
}

.pg-logout-button:hover {
    background: var(--pg-surface-muted);
    color: var(--pg-text);
}

@media (max-width: 900px) {
    .pg-user-details {
        display: none;
    }

    .pg-logout-form {
        margin-left: 8px;
    }
}
