* {
    box-sizing: border-box;
}

html,
body,
#app {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    font-family: "Microsoft YaHei", sans-serif;
    color: #303133;
    background: #edf1f7;
}

[v-cloak] {
    display: none;
}

:root,
.app-shell[data-theme="default"] {
    --logo-color: #409eff;
    --sidebar-bg: #1c1e23;
    --sidebar-default-text: rgba(242, 242, 242, 0.8);
    --sidebar-select-text: #ffffff;
    --sidebar-select-bg: #2e3033;
    --sidebar-hover-bg: #2e3033;
    --sidebar-hover-text: #ffffff;
    --sidebar-icon-text: rgba(255, 255, 255, 0.75);
    --tab-hover-text: #409eff;
    --tab-select-text: #ffffff;
    --tab-select-bg: #409eff;
    --topbar-bg: rgba(255, 255, 255, 0.96);
    --topbar-text: #303133;
    --topbar-tab-hover: #f3f7ff;
}

.app-shell[data-theme="dark1"] {
    --logo-color: #16b777;
    --sidebar-bg: #ffffff;
    --sidebar-default-text: rgba(0, 0, 0, 0.8);
    --sidebar-select-text: #16b777;
    --sidebar-select-bg: #f4fbf8;
    --sidebar-hover-bg: #f7faf8;
    --sidebar-hover-text: #16b777;
    --sidebar-icon-text: rgba(0, 0, 0, 0.7);
    --tab-hover-text: #16b777;
    --tab-select-text: #ffffff;
    --tab-select-bg: #16b777;
}

.app-shell[data-theme="dark2"] {
    --logo-color: #1890ff;
    --sidebar-bg: #ffffff;
    --sidebar-default-text: rgba(0, 0, 0, 0.8);
    --sidebar-select-text: #1890ff;
    --sidebar-select-bg: #eef6ff;
    --sidebar-hover-bg: #f4f9ff;
    --sidebar-hover-text: #1890ff;
    --sidebar-icon-text: rgba(0, 0, 0, 0.7);
    --tab-hover-text: #1890ff;
    --tab-select-text: #ffffff;
    --tab-select-bg: #1890ff;
}

.app-shell {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top right, rgba(64, 158, 255, 0.12), transparent 22%),
        linear-gradient(180deg, #f8fbff 0%, #edf1f7 100%);
}

.shell-header {
    height: 52px;
    padding: 0 16px;
    border-bottom: 1px solid #e7ebf3;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.shell-header-left,
.shell-header-right {
    display: flex;
    align-items: center;
    min-width: 0;
}

.shell-header-left {
    flex: 1;
    gap: 14px;
}

.shell-logo {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--logo-color);
    font-size: 18px;
    font-weight: 700;
}

.shell-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover {
    background: #eef4ff;
    transform: translateY(-1px);
}

.icon-btn img {
    width: 17px;
    height: 17px;
    opacity: 0.72;
}

.top-level-tabs {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.top-level-tabs::-webkit-scrollbar {
    display: none;
}

.top-level-tab {
    height: 36px;
    padding: 0 14px;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: var(--topbar-text);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.top-level-tab:hover {
    color: var(--logo-color);
    background: var(--topbar-tab-hover);
}

.top-level-tab.active {
    color: var(--logo-color);
    background: linear-gradient(180deg, rgba(64, 158, 255, 0.12), rgba(64, 158, 255, 0.05));
    font-weight: 700;
}

.shell-header-right {
    gap: 10px;
}

.user-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-entry:hover {
    background: #f5f8fe;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.user-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.shell-main {
    flex: 1;
    min-height: 0;
    display: flex;
}

.shell-sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    color: var(--sidebar-default-text);
    border-right: 1px solid rgba(228, 231, 237, 0.6);
    transition: width 0.25s ease;
    flex-shrink: 0;
}

.shell-sidebar.collapsed {
    width: 0;
    border-right: none;
    overflow: hidden;
}

.sidebar-scroll {
    height: 100%;
    overflow: auto;
    padding: 10px 8px;
}

.menu-home {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--sidebar-default-text);
    margin-bottom: 8px;
}

.menu-home:hover,
.menu-home.active {
    color: var(--sidebar-select-text);
    background: var(--sidebar-select-bg);
}

.side-menu {
    border-right: none !important;
    background: transparent !important;
}

.side-menu .el-menu {
    border-right: none;
    background: transparent;
}

.side-menu .el-sub-menu__title,
.side-menu .el-menu-item {
    height: 40px;
    line-height: 40px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: var(--sidebar-default-text);
    background: transparent;
}

.side-menu .el-sub-menu__title i,
.side-menu .el-menu-item i {
    color: var(--sidebar-icon-text);
}

.side-menu .el-sub-menu__title:hover,
.side-menu .el-menu-item:hover,
.side-menu .el-menu-item.is-active {
    color: var(--sidebar-hover-text);
    background: var(--sidebar-hover-bg);
}

.side-menu .el-menu-item.is-active {
    color: var(--sidebar-select-text);
    background: var(--sidebar-select-bg);
}

.side-menu .el-menu-item.is-active i {
    color: var(--sidebar-select-text);
}

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

.tab-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 10px 12px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.65);
    border-bottom: 1px solid #e8edf6;
}

.tab-strip::-webkit-scrollbar {
    height: 6px;
}

.tab-strip::-webkit-scrollbar-thumb {
    background: rgba(144, 147, 153, 0.35);
    border-radius: 999px;
}

.tab-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    color: #606266;
    cursor: pointer;
    border: 1px solid #e6ebf5;
    white-space: nowrap;
    user-select: none;
    animation: tabSlideIn 0.2s ease;
}

.tab-pill:hover {
    color: var(--tab-hover-text);
}

.tab-pill.active {
    color: var(--tab-select-text);
    background: var(--tab-select-bg);
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(64, 158, 255, 0.18);
}

.tab-close {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 18px;
}

.tab-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.content-frame {
    flex: 1;
    min-height: 0;
    padding: 10px 12px 12px;
}

.page-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(28, 40, 66, 0.08);
}

.dialog-frame {
    width: 100%;
    height: 420px;
    border: none;
}

.tab-context-menu {
    position: fixed;
    z-index: 2100;
    width: 140px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e6eaf2;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.14);
}

.tab-context-menu button {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: #303133;
}

.tab-context-menu button:hover {
    background: #f5f8ff;
    color: var(--logo-color);
}

@keyframes tabSlideIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 960px) {
    .shell-logo {
        width: auto;
    }

    .user-name {
        max-width: 100px;
    }
}

@media (max-width: 768px) {
    .shell-header {
        padding: 0 10px;
    }

    .top-level-tabs {
        display: none;
    }

    .shell-sidebar {
        position: fixed;
        left: 0;
        top: 52px;
        bottom: 0;
        z-index: 20;
    }

    .shell-sidebar.collapsed {
        transform: translateX(-100%);
        width: 220px;
    }
}
