/* ============================================================
   frame.css — 后台主框架原创样式（Vue 版 · 左侧双栏布局）
   一级分类窄栏 + 二级分类宽栏 + 内容区（无顶部导航）
   设计体系：奶白主题 / #f0f2f5 画布 / #1e9fff 主色
   ============================================================ */

:root {
    --vg-canvas: #f0f2f5;
    --vg-panel: #faf8f5;
    --vg-panel-deep: #f5f0e8;
    --vg-line: #e8e4df;
    --vg-text: #333840;
    --vg-text-sub: #7a8494;
    --vg-primary: #1e9fff;
    --vg-primary-weak: rgba(30, 159, 255, 0.09);
    --vg-danger: #f56c6c;
    --vg-rail-w: 80px;
    --vg-side-w: 216px;
    --vg-tabbar-h: 44px;
    --vg-radius: 6px;
    --vg-shadow: 0 2px 10px rgba(31, 35, 41, 0.06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.vg-body {
    margin: 0;
    background: var(--vg-canvas);
    color: var(--vg-text);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    overflow: hidden;
}

.vg-app { height: 100vh; display: flex; overflow: hidden; }

/* ============ 左侧一级分类窄栏 ============ */
.vg-rail {
    width: var(--vg-rail-w);
    flex: none;
    background: var(--vg-panel);
    border-right: 1px solid var(--vg-line);
    display: flex;
    flex-direction: column;
    z-index: 45;
}

.vg-rail-logo {
    height: 56px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--vg-line);
}

.vg-rail-logo img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }

.vg-rail-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px;
    scrollbar-width: none;
}

.vg-rail-menu::-webkit-scrollbar { display: none; }

.vg-rail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding: 11px 2px 9px;
    margin-bottom: 4px;
    border: none;
    border-radius: var(--vg-radius);
    background: transparent;
    color: var(--vg-text-sub);
    cursor: pointer;
    transition: background .16s, color .16s;
}

.vg-rail-btn i { font-size: 19px; line-height: 1; }

.vg-rail-txt {
    font-size: 12px;
    line-height: 1.25;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.vg-rail-btn:hover { background: var(--vg-primary-weak); color: var(--vg-primary); }

.vg-rail-btn.on { background: var(--vg-primary); color: #fff; font-weight: 600; }

/* ============ 左侧二级分类栏 ============ */
.vg-side {
    width: var(--vg-side-w);
    flex: none;
    background: #fff;
    border-right: 1px solid var(--vg-line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .26s cubic-bezier(.4, 0, .2, 1);
    z-index: 40;
}

.vg-side.fold { width: 0; border-right: none; }

.vg-side-head {
    height: 56px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border-bottom: 1px solid var(--vg-line);
}

.vg-side-title {
    flex: 1;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--vg-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vg-side-back { display: none; }

.vg-side-fold svg { width: 15px; height: 15px; }

.vg-side.fold .vg-side-fold svg { transform: rotate(180deg); }

/* ---------- 菜单树 ---------- */
.vg-menu { list-style: none; margin: 0; padding: 8px 10px; overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: none; }

.vg-menu::-webkit-scrollbar { display: none; }

.vg-m1 { position: relative; margin-bottom: 2px; }

.vg-m1 > .vg-mtitle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--vg-radius);
    color: var(--vg-text);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.vg-m1 > .vg-mtitle:hover { background: var(--vg-primary-weak); color: var(--vg-primary); }

.vg-m1.open > .vg-mtitle { background: var(--vg-panel-deep); font-weight: 600; }

.vg-m1.active > .vg-mtitle { background: var(--vg-primary); color: #fff; }

.vg-m1.active > .vg-mtitle:hover { background: var(--vg-primary); color: #fff; }

.vg-mtitle i.vg-ico { font-size: 16px; width: 18px; text-align: center; flex: none; }

.vg-mtitle .vg-mtext {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vg-arrow {
    width: 12px;
    height: 12px;
    flex: none;
    color: var(--vg-text-sub);
    transition: transform .2s;
}

.vg-m1.open > .vg-mtitle .vg-arrow { transform: rotate(90deg); }

.vg-m1.active > .vg-mtitle .vg-arrow { color: rgba(255, 255, 255, .85); }

/* 二级列表（三级菜单） */
.vg-m2-wrap { overflow: hidden; max-height: 0; transition: max-height .3s ease; }

.vg-m1.open > .vg-m2-wrap { max-height: 1000px; }

.vg-m2 { list-style: none; margin: 2px 0 6px; padding: 0 0 0 28px; }

.vg-m2 a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 1px;
    border-radius: 4px;
    color: var(--vg-text-sub);
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.vg-m2 a:hover { color: var(--vg-primary); background: var(--vg-primary-weak); }

.vg-m2 a.active { background: var(--vg-primary); color: #fff; }

.vg-m2 i.vg-ico { font-size: 14px; width: 16px; text-align: center; flex: none; }

.vg-m2 a.vg-m2g { color: var(--vg-text); font-weight: 600; }

.vg-m2 a.vg-m2g .vg-arrow { margin-left: auto; }

.vg-m2i.open > a.vg-m2g { color: var(--vg-primary); }

.vg-m2i.open > a.vg-m2g .vg-arrow { transform: rotate(90deg); }

/* 三级列表（四级菜单） */
.vg-m3 { list-style: none; margin: 2px 0 4px; padding: 0 0 0 24px; max-height: 0; overflow: hidden; transition: max-height .3s ease; }

.vg-m2i.open > .vg-m3 { max-height: 600px; }

.vg-m3 a {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    margin-bottom: 1px;
    border-radius: 4px;
    color: var(--vg-text-sub);
    font-size: 12.5px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.vg-m3 a:hover { color: var(--vg-primary); background: var(--vg-primary-weak); }

.vg-m3 a.active { background: var(--vg-primary); color: #fff; }

/* ============ 内容区 ============ */
.vg-content { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--vg-canvas); }

.vg-tabbar {
    height: var(--vg-tabbar-h);
    flex: none;
    display: flex;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--vg-line);
    padding: 0 6px 0 0;
}

.vg-tabs-scroll {
    flex: 1;
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.vg-tabs-scroll::-webkit-scrollbar { height: 2px; }

.vg-tabs-scroll::-webkit-scrollbar-thumb { background: var(--vg-line); border-radius: 2px; }

.vg-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    margin: 5px 3px;
    border-radius: var(--vg-radius);
    font-size: 12.5px;
    color: var(--vg-text-sub);
    cursor: pointer;
    white-space: nowrap;
    flex: none;
    transition: background .15s, color .15s;
}

.vg-tab:hover { color: var(--vg-primary); }

.vg-tab.active { background: var(--vg-primary); color: #fff; }

.vg-tab .vg-close {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    color: inherit;
    opacity: .55;
}

.vg-tab .vg-close:hover { opacity: 1; background: rgba(0, 0, 0, .14); }

.vg-tab.active .vg-close:hover { background: rgba(255, 255, 255, .3); }

.vg-tab .vg-close svg { width: 10px; height: 10px; }

/* Tab 栏右侧工具区 */
.vg-tabbar-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: none;
    padding-left: 8px;
    border-left: 1px solid var(--vg-line);
}

.vg-hbtn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--vg-radius);
    color: var(--vg-text-sub);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .16s, color .16s;
    flex: none;
}

.vg-hbtn:hover { background: var(--vg-primary-weak); color: var(--vg-primary); }

.vg-hbtn svg { width: 16px; height: 16px; }

.vg-tab-tools { display: flex; align-items: center; gap: 2px; position: relative; }

.vg-tools-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid var(--vg-line);
    border-radius: var(--vg-radius);
    box-shadow: var(--vg-shadow);
    padding: 5px;
    min-width: 108px;
    z-index: 50;
    display: none;
}

.vg-tab-tools.open .vg-tools-menu { display: block; }

.vg-tools-menu a { display: block; padding: 7px 10px; font-size: 12.5px; color: var(--vg-text); border-radius: 4px; cursor: pointer; text-decoration: none; }

.vg-tools-menu a:hover { background: var(--vg-primary-weak); color: var(--vg-primary); }

/* 用户区 */
.vg-user { position: relative; margin-left: 4px; }

.vg-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 8px;
    border: none;
    background: transparent;
    border-radius: var(--vg-radius);
    cursor: pointer;
    color: var(--vg-text);
}

.vg-user-btn:hover { background: var(--vg-primary-weak); }

.vg-user-btn img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

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

.vg-caret { width: 12px; height: 12px; color: var(--vg-text-sub); transition: transform .2s; }

.vg-user.open .vg-caret { transform: rotate(180deg); }

.vg-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 168px;
    background: #fff;
    border: 1px solid var(--vg-line);
    border-radius: var(--vg-radius);
    box-shadow: var(--vg-shadow);
    padding: 6px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .18s, transform .18s;
    z-index: 80;
}

.vg-user.open .vg-dropdown { opacity: 1; transform: translateY(0); pointer-events: auto; }

.vg-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    color: var(--vg-text);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}

.vg-dropdown a:hover { background: var(--vg-primary-weak); color: var(--vg-primary); }

.vg-dropdown a svg { width: 15px; height: 15px; color: var(--vg-text-sub); }

.vg-dropdown a:hover svg { color: var(--vg-primary); }

.vg-dropdown .vg-logout { color: var(--vg-danger); }

.vg-dropdown .vg-logout svg { color: var(--vg-danger); }

.vg-dropdown .vg-logout:hover { background: rgba(245, 108, 108, .09); color: var(--vg-danger); }

.vg-drop-sep { height: 1px; background: var(--vg-line); margin: 5px 8px; }

/* 视口 */
.vg-views { flex: 1; min-height: 0; position: relative; }

.vg-pane { position: absolute; inset: 0; border: none; width: 100%; height: 100%; overflow: auto; }

.vg-pane iframe { width: 100%; height: 100%; border: none; display: block; background: var(--vg-canvas); }

.vg-vue-host { width: 100%; min-height: 100%; }

/* 加载中 */
.vg-boot {
    position: fixed;
    inset: 0;
    background: var(--vg-canvas);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
    transition: opacity .3s;
}

.vg-boot.hide { opacity: 0; pointer-events: none; }

.vg-boot-spin {
    width: 34px;
    height: 34px;
    border: 3px solid var(--vg-primary-weak);
    border-top-color: var(--vg-primary);
    border-radius: 50%;
    animation: vg-rotate .8s linear infinite;
}

@keyframes vg-rotate { to { transform: rotate(360deg); } }

.vg-boot p { color: var(--vg-text-sub); font-size: 13px; margin: 0; }

/* Toast */
.vg-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--vg-line);
    box-shadow: var(--vg-shadow);
    border-radius: var(--vg-radius);
    padding: 9px 18px;
    font-size: 13px;
    color: var(--vg-text);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vg-toast.ok { color: #16b777; }

.vg-toast.err { color: var(--vg-danger); }

/* ============ 移动端 ============ */
@media (max-width: 768px) {
    .vg-rail { width: 60px; }
    .vg-rail-logo { height: 50px; }
    .vg-rail-logo img { width: 30px; height: 30px; }
    .vg-rail-menu { padding: 8px 6px; }
    .vg-rail-btn { padding: 9px 2px 8px; gap: 4px; }
    .vg-rail-btn i { font-size: 17px; }
    .vg-rail-txt { font-size: 11px; }

    .vg-side {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 60px;
        width: 230px !important;
        transform: translateX(-115%);
        transition: transform .25s cubic-bezier(.4, 0, .2, 1);
        box-shadow: 6px 0 20px rgba(0, 0, 0, .12);
        z-index: 60;
    }

    .vg-side.mobile-show { transform: translateX(0); }
    .vg-side.mobile-show.fold { width: 230px !important; border-right: 1px solid var(--vg-line); }

    .vg-side-head { height: 50px; }
    .vg-side-back { display: inline-flex; }
    .vg-side-fold { display: none; }

    .vg-mask {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .3);
        z-index: 55;
    }

    .vg-user-name, .vg-caret { display: none; }

    .vg-mobile-only { display: inline-flex !important; }
    .vg-pc-only { display: none !important; }
}

@media (min-width: 769px) {
    .vg-mobile-only { display: none !important; }
    .vg-pc-only { display: inline-flex !important; }
}
