.app-layout {
    display: flex;
    min-height: calc(100vh - 76px);
    position: relative;
}

.app-content-shell {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-sidebar-modern {
    width: 304px;
    min-width: 304px;
    position: sticky;
    top: 76px;
    height: calc(100vh - 76px);
    z-index: 1040;
    background: var(--sidebar-bg, #ffffff);
    border-right: 1px solid var(--border-soft, #e5e7eb);
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.04);
}

.app-sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app-sidebar-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0;
}

.app-sidebar-brandline {
    padding: 1.25rem 1rem 0.95rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: inherit;
}

.app-sidebar-logo {
    width: 2.95rem;
    height: 2.95rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f63d9, #6d5df6);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(79, 99, 217, 0.22);
}

.app-sidebar-logo-icon {
    width: 1.3rem;
    height: 1.3rem;
}

.app-sidebar-brand-copy {
    display: grid;
    gap: 0.2rem;
}

.app-sidebar-kicker {
    color: var(--text-muted, #6b7280);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.app-sidebar-title {
    color: var(--text-main, #1f2937);
    font-size: 1.05rem;
    font-weight: 700;
}

.app-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.95rem 0.85rem 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}

.app-sidebar-scroll::-webkit-scrollbar {
    width: 7px;
}

.app-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.46);
    border-radius: 999px;
}

.sidebar-group-card {
    margin-bottom: 0.55rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    background: transparent;
    overflow: hidden;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-group-card.is-open,
.sidebar-group-card.is-active {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.sidebar-parent {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-main, #1f2937);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 0.95rem;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 700;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-parent:hover {
    background: var(--sidebar-hover, #eef2ff);
    color: var(--primary, #4f63d9);
}

.sidebar-group-card.is-active .sidebar-parent {
    color: var(--primary, #4f63d9);
}

.sidebar-parent-icon,
.sidebar-child-icon,
.sidebar-chevron-icon,
.sidebar-toggle-icon,
.sidebar-close-icon {
    width: 1.08rem;
    height: 1.08rem;
    flex-shrink: 0;
}

.sidebar-parent-icon {
    color: var(--text-muted, #6b7280);
}

.sidebar-parent-label {
    flex: 1;
    min-width: 0;
}

.sidebar-parent-chevron {
    color: #94a3b8;
    display: inline-flex;
    transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-group-card.is-open .sidebar-parent-chevron {
    transform: rotate(90deg);
    color: var(--primary, #4f63d9);
}

.sidebar-children {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.22s ease, opacity 0.22s ease;
}

.sidebar-group-card.is-collapsed .sidebar-children {
    grid-template-rows: 0fr;
    opacity: 0;
}

.sidebar-children-inner {
    min-height: 0;
    overflow: hidden;
    padding: 0 0.95rem 0.9rem 0.95rem;
}

.sidebar-child-rail {
    margin-left: 1.4rem;
    padding-left: 0.9rem;
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    display: grid;
    gap: 0.28rem;
}

.sidebar-child {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 42px;
    padding: 0.68rem 0.84rem;
    border-radius: 0.9rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-child:hover {
    background: var(--sidebar-hover, #eef2ff);
    color: var(--primary, #4f63d9);
    transform: translateX(2px);
}

.sidebar-child.is-active {
    background: linear-gradient(135deg, #4f63d9, #6d5df6);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(79, 99, 217, 0.22);
}

.sidebar-child-icon {
    color: #94a3b8;
}

.sidebar-child:hover .sidebar-child-icon,
.sidebar-child.is-active .sidebar-child-icon {
    color: inherit;
}

.app-sidebar-footer {
    padding: 0.95rem 1rem 1.1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(248, 250, 252, 0.82);
}

.app-sidebar-footer-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
}

.app-sidebar-footer-value {
    margin-top: 0.35rem;
    color: var(--text-main, #1f2937);
    font-weight: 600;
}

.app-sidebar-toggle,
.app-sidebar-close {
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #ffffff;
    color: var(--text-main, #1f2937);
}

.app-sidebar-toggle:hover,
.app-sidebar-close:hover {
    background: var(--sidebar-hover, #eef2ff);
    color: var(--primary, #4f63d9);
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 76px 0 0 0;
    z-index: 1035;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sidebar-open .app-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.app-main {
    flex: 1;
    padding: 1.5rem 1.65rem 2rem;
}

.app-main.app-main-full {
    max-width: 100%;
}

.app-topbar-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-topbar-left,
.app-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--text-main, #1f2937) !important;
    text-decoration: none;
    margin-right: 0;
}

.app-brand-mark {
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f63d9, #6d5df6);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(79, 99, 217, 0.2);
}

.app-brand-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.app-brand-copy {
    display: grid;
    gap: 0.16rem;
}

.app-brand-copy strong {
    font-size: 1rem;
    line-height: 1.1;
}

.app-brand-copy small {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
}

.app-topbar-context {
    padding: 0.58rem 0.85rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.78);
    display: inline-flex;
    flex-direction: column;
    gap: 0.14rem;
}

.app-topbar-context-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
}

.app-topbar-theme-form {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    padding: 0.45rem 0.6rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.82);
}

.app-topbar-theme-form label {
    color: var(--text-muted, #6b7280);
    font-weight: 600;
}

.app-user-chip {
    padding: 0.35rem 0.45rem 0.35rem 0.35rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.82);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: inherit;
}

.app-user-avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f63d9, #6d5df6);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
}

.app-user-copy {
    display: grid;
    gap: 0.1rem;
}

.app-user-copy strong {
    font-size: 0.88rem;
    color: var(--text-main, #1f2937);
}

.app-user-copy small {
    font-size: 0.72rem;
    text-transform: capitalize;
    color: var(--text-muted, #6b7280);
}

@media (max-width: 1199.98px) {
    .app-sidebar-modern {
        width: 286px;
        min-width: 286px;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar-modern {
        position: fixed;
        top: 76px;
        left: 0;
        transform: translateX(-100%);
        height: calc(100vh - 76px);
        transition: transform 0.24s ease;
    }

    .sidebar-open .app-sidebar-modern {
        transform: translateX(0);
    }

    .app-sidebar-header {
        display: flex;
    }

    .app-main {
        padding: 1.1rem 1rem 1.6rem;
    }

    .app-topbar-context {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .app-sidebar-modern {
        width: min(90vw, 304px);
        min-width: min(90vw, 304px);
    }

    .app-topbar-right {
        gap: 0.55rem;
    }

    .app-topbar-theme-form {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .app-brand-copy small,
    .app-user-copy {
        display: none;
    }

    .app-brand-mark,
    .app-sidebar-logo {
        width: 2.65rem;
        height: 2.65rem;
    }
}
