* { margin: 0; padding: 0; box-sizing: border-box; }

html, body, .app-shell {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background: #f2f3f5;
}

.app-shell {
    display: flex;
}

.app-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #2f4050;
    color: #fff;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

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

.app-sidebar h2 {
    text-align: center;
    padding: 24px 12px 20px;
    font-size: 18px;
    border-bottom: 1px solid #3d5069;
}

.app-menu-toggle {
    display: none;
}

.app-menu-backdrop {
    display: none;
}

.app-sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.app-menu {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

.app-menu li {
    padding: 14px 20px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.app-menu li:hover {
    background: #3a5266;
}

.app-menu li.active {
    background: #1ab394;
}

.app-sidebar-footer {
    padding: 12px;
    border-top: 1px solid #3d5069;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

.app-sidebar-footer a {
    color: #1ab394;
    text-decoration: none;
    cursor: pointer;
}

.app-main {
    flex: 1;
    height: 100vh;
    background: #f2f3f5;
}

.app-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #f2f3f5;
}

@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }
    .app-sidebar {
        width: 100%;
        height: auto;
        max-height: none;
        position: relative;
        z-index: 100;
        flex-shrink: 0;
    }
    .app-sidebar-header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 52px;
        border-bottom: 1px solid #3d5069;
    }
    .app-sidebar h2 {
        padding: 14px 0;
        border-bottom: none;
        text-align: center;
        font-size: 17px;
        width: 100%;
    }
    .app-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        flex-shrink: 0;
    }
    .app-menu-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: #fff;
        border-radius: 1px;
        transition: transform 0.2s, opacity 0.2s;
    }
    .app-sidebar.open .app-menu-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .app-sidebar.open .app-menu-toggle span:nth-child(2) {
        opacity: 0;
    }
    .app-sidebar.open .app-menu-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
    .app-sidebar.open .app-menu-toggle {
        transform: translateY(-50%);
    }
    .app-sidebar-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #2f4050;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
        z-index: 102;
        max-height: calc(100vh - 52px);
        overflow-y: auto;
    }
    .app-sidebar.open .app-sidebar-nav {
        display: block;
    }
    .app-menu-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 101;
    }
    .app-sidebar.open .app-menu-backdrop {
        display: block;
    }
    .app-menu {
        display: block;
        flex: none;
        overflow-y: visible;
    }
    .app-menu li {
        text-align: left;
        font-size: 15px;
        padding: 14px 20px;
        border-bottom: 1px solid #3d5069;
    }
    .app-sidebar-footer {
        padding: 16px 20px;
    }
    .app-main {
        height: calc(100vh - 52px);
        min-height: 300px;
    }
}
