* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: var(--app-height, 100vh);
    height: var(--app-height, 100dvh);
    background: #fff;
    color: #333;
    overflow: hidden;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    display: flex;
}

.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10000;
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 16px;
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-menu {
    display: none;
}

.sidebar-header {
    height: 50px;
    padding: 0 16px;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #f0f0f0;
    color: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.menu-item-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    border-radius: 8px;
    transition: background 0.2s;
}

.menu-item-wrapper:hover {
    background: #f0f4f9;
}

.menu-item {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
}

.menu-item-wrapper.active {
    background: #e8f0fe;
}

.menu-item-wrapper.active .menu-item {
    color: #1a73e8;
    font-weight: 600;
}

.menu-item .icon {
    margin-right: 10px;
    font-size: 16px;
    flex-shrink: 0;
}

.menu-item .text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.open-external {
    padding: 10px;
    color: #999;
    text-decoration: none;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.menu-item-wrapper:hover .open-external {
    opacity: 1;
}

.open-external:hover {
    color: #1a73e8;
}

.toggle-btn {
    position: absolute;
    right: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    color: #57606a;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 102;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
}

.sidebar.collapsed .toggle-btn {
    right: -13px;
    transform: translateY(-50%) rotate(180deg);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    background: #fff;
}

iframe[hidden] {
    display: none;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 15px;
    text-align: center;
    padding: 20px;
    flex: 1;
    background: #fff;
}

.mobile-edge-trigger {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: 25px;
    z-index: 9998;
    cursor: pointer;
}

.mobile-floating-btn {
    display: none;
    position: fixed;
    top: 40%;
    left: 12px;
    z-index: 9999;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(6px);
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    cursor: move;
    user-select: none;
    touch-action: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.empty-menu {
    padding: 15px;
    color: #999;
    font-size: 13px;
}

@media (max-width: 1024px),
(pointer: coarse) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 240px !important;
        transform: translateX(-100%);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
    }

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

    .sidebar.collapsed {
        width: 240px !important;
    }

    .toggle-btn {
        display: none;
    }

    .backdrop.show {
        display: block;
    }

    .mobile-edge-trigger {
        display: block;
    }

    .mobile-floating-btn {
        display: flex;
    }

    .open-external {
        opacity: 1;
    }
}