/* shell.css — 控制台框架样式（复刻kk8 /console 深色主题） */
:root {
    --app-sidebar: 272px;
    --app-header: 76px;
    --app-tabs: 48px;
    --app-bg: #07111f;
    --app-bg-soft: #0b1727;
    --app-panel: rgba(14, 29, 48, .94);
    --app-panel-soft: rgba(17, 37, 60, .78);
    --app-border: rgba(148, 188, 226, .14);
    --app-text: #edf7ff;
    --app-muted: #86a0b8;
    --app-primary: #39a7ff;
    --app-primary-2: #6e5cff;
    --app-success: #2ad6a0;
    --app-danger: #ff647c;
    --app-radius: 16px;
    --app-shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html, body { width: 100%; min-width: 0; height: 100%; overflow: hidden; }

body {
    margin: 0;
    color: var(--app-text);
    font-family: "Microsoft JhengHei", "PingFang TC", "Segoe UI", sans-serif;
    background: radial-gradient(circle at 88% 0%, rgba(57, 167, 255, .10), transparent 28rem), var(--app-bg);
}

a { transition: color .18s ease, background .18s ease, transform .18s ease; }

.main-layout {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: transparent;
}

/* ================= 侧边栏 ================= */
.main-layout-side {
    position: fixed !important;
    z-index: 1002 !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: var(--app-sidebar) !important;
    height: 100vh !important;
    overflow: hidden;
    border-right: 1px solid var(--app-border);
    background:
        radial-gradient(circle at 0 0, rgba(57, 167, 255, .15), transparent 20rem),
        linear-gradient(180deg, #0d1c2f 0%, #091522 100%) !important;
    box-shadow: 14px 0 40px rgba(0, 0, 0, .20);
    transition: width .25s ease, transform .25s ease !important;
}

.sidebar-brand {
    display: flex;
    height: var(--app-header);
    padding: 0 22px;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid var(--app-border);
}

.sidebar-brand-mark {
    position: relative;
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    overflow: hidden;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: -0.5px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 13px;
    background: linear-gradient(145deg, var(--app-primary), var(--app-primary-2));
    box-shadow: 0 8px 24px rgba(57, 167, 255, .24);
    place-items: center;
}

.sidebar-brand-text { position: relative; z-index: 2; line-height: 1; letter-spacing: -0.5px; }
.sidebar-brand-text b { color: #7fe3ff; font-weight: 900; }

.sidebar-brand-mark::after {
    content: "";
    position: absolute;
    z-index: 1;
    width: 28px;
    height: 8px;
    right: -8px;
    bottom: 5px;
    opacity: .7;
    border-radius: 999px;
    background: #78e7ff;
    transform: rotate(-45deg);
}

.sidebar-brand-copy { min-width: 0; line-height: 1.2; }

.sidebar-brand-copy strong {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 17px;
    font-weight: 850;
    letter-spacing: .04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-brand-copy small {
    display: block;
    margin-top: 6px;
    color: #6f8ba5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.side-nav {
    width: 100% !important;
    height: calc(100vh - var(--app-header));
    margin: 0;
    padding: 15px 12px 32px !important;
    overflow-x: hidden;
    overflow-y: auto;
    list-style: none;
    border-radius: 0;
    background: transparent !important;
    scrollbar-color: rgba(126, 163, 195, .25) transparent;
    scrollbar-width: thin;
}
.side-nav::-webkit-scrollbar { width: 5px; }
.side-nav::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(126, 163, 195, .25); }

.side-nav hr { display: none; }

.side-nav .hidden-folded {
    height: auto;
    min-height: 0;
    padding: 15px 12px 8px !important;
    margin: 0 !important;
    line-height: 1.2;
}

.side-nav .hidden-folded span,
.side-nav .hidden-folded span[style] {
    color: #607d96 !important;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.side-nav .nav-item { margin: 3px 0; list-style: none; border-radius: 12px; }

.side-nav .nav-item > a {
    display: flex;
    min-height: 44px;
    padding: 0 13px !important;
    color: #a8bfd3 !important;
    font-size: 14px;
    font-weight: 650;
    line-height: 44px !important;
    border-radius: 11px;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}

.side-nav .nav-item > a:hover,
.side-nav .nav-item.nav-open > a,
.side-nav .nav-item .nav-child a.active {
    color: #fff !important;
    background: rgba(57, 167, 255, .10) !important;
}

.side-nav .nav-item .nav-child a.active {
    box-shadow: inset 3px 0 0 var(--app-primary);
}

.side-nav .nav-item > a > i {
    width: 24px;
    color: #55b6ff;
    font-size: 15px;
    text-align: center;
}

.side-nav .nav-more {
    margin-left: auto;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #58738d;
    transition: transform .2s ease, border-color .2s ease;
}

.side-nav .nav-item.nav-open .nav-more {
    transform: rotate(180deg);
    border-top-color: transparent;
    border-bottom: 5px solid #8ccfff;
}

.side-nav .nav-child {
    display: none;
    padding: 5px 0 7px 22px !important;
    border: 0 !important;
    background: transparent !important;
    margin: 0;
}

.side-nav .nav-item.nav-open .nav-child { display: block; }

.side-nav .nav-child a {
    display: block;
    min-height: 36px;
    padding: 0 12px !important;
    color: #7895ae !important;
    font-size: 13px;
    line-height: 36px !important;
    border-radius: 9px;
    text-decoration: none;
    cursor: pointer;
}

.side-nav .nav-child a:hover,
.side-nav .nav-child a.active {
    color: #dff3ff !important;
    background: rgba(255, 255, 255, .045) !important;
}

/* ================= 右侧容器 ================= */
.main-layout-container {
    position: relative !important;
    left: 0 !important;
    width: auto !important;
    height: 100vh !important;
    min-height: 0 !important;
    margin: 0 0 0 var(--app-sidebar) !important;
    background: transparent !important;
    transition: margin-left .25s ease !important;
}

/* ================= 顶部工具栏 ================= */
.main-layout-header {
    position: absolute !important;
    z-index: 1000;
    top: 0 !important;
    right: 0;
    left: 0 !important;
    display: flex !important;
    width: auto !important;
    height: var(--app-header) !important;
    padding: 0 18px !important;
    color: #eaf4ff;
    border-bottom: 1px solid rgba(129, 183, 233, 0.13);
    background: rgba(7, 17, 31, 0.94) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-sizing: border-box;
    align-items: center;
    gap: 14px;
}

/* 侧栏收合按钮 */
.main-layout-header .modern-menu-btn {
    position: relative !important;
    display: flex;
    align-items: center;
    justify-content: center;
    float: none !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.main-layout-header .sidebar-toggle-button {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0 !important;
    overflow: hidden;
    color: #94a3b8 !important;
    text-decoration: none !important;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(30, 50, 76, 0.82), rgba(13, 29, 49, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.main-layout-header .sidebar-toggle-button::before {
    position: absolute;
    inset: 0;
    content: "";
    opacity: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 0, rgba(70, 168, 255, 0.25), transparent 72%);
    transition: opacity 0.2s ease;
}

.main-layout-header .sidebar-toggle-button:hover {
    color: #ffffff !important;
    border-color: rgba(70, 168, 255, 0.45);
    background: linear-gradient(145deg, rgba(32, 67, 103, 0.96), rgba(14, 35, 60, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 26px rgba(14, 93, 170, 0.24);
    transform: translateY(-1px);
}

.main-layout-header .sidebar-toggle-button:hover::before { opacity: 1; }
.main-layout-header .sidebar-toggle-button:active { transform: scale(0.94); }

.sidebar-toggle-icon { position: relative; z-index: 1; width: 23px; height: 23px; }
.sidebar-icon-frame, .sidebar-icon-divider, .sidebar-icon-arrow {
    fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-icon-frame { stroke-width: 1.5; opacity: 0.72; }
.sidebar-icon-divider { stroke: #60a5fa; stroke-width: 1.6; }
.sidebar-icon-arrow { stroke-width: 1.9; transition: stroke 0.2s ease; }

.modern-menu-btn.is-collapsed .sidebar-toggle-button {
    color: #7dd3fc !important;
    border-color: rgba(70, 168, 255, 0.34);
    background: linear-gradient(145deg, rgba(30, 73, 112, 0.88), rgba(14, 35, 60, 0.98));
}

/* 登录账号 */
.modern-topbar-copy {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: #91a9c1;
    font-size: 13px;
}

.modern-topbar-copy::before {
    display: block;
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    content: "";
    border-radius: 50%;
    background: #20d4a2;
    box-shadow: 0 0 0 5px rgba(32, 212, 162, 0.1);
}

.modern-topbar-copy strong {
    overflow: hidden;
    color: #f4f8ff;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 右侧操作区 */
.modern-topbar-actions {
    display: flex;
    flex: 0 0 auto;
    min-width: 0;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.balance-chip {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: max-content;
    height: 40px;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 14px;
    color: #a9bed3;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 13px;
    background: rgba(30, 55, 82, 0.58);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
    font-size: 13px;
    white-space: nowrap;
}

.balance-chip > i { color: #60a5fa; font-size: 13px; }
.balance-chip > strong { display: inline-flex; flex: 0 0 auto; align-items: center; color: #ffffff; font-weight: 700; white-space: nowrap; }
.balance-chip #lbl_MyBalance { color: #7dd3fc !important; font-variant-numeric: tabular-nums; white-space: nowrap; }

.balance-refresh {
    display: inline-flex;
    width: 29px;
    height: 29px;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    color: #7f98b3 !important;
    text-decoration: none !important;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.045);
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.balance-refresh:hover { color: #7dd3fc !important; background: rgba(96, 165, 250, 0.13); transform: rotate(25deg); }
.balance-refresh.is-loading { color: #60a5fa !important; pointer-events: none; }
.balance-refresh.is-loading i { animation: balance-refresh-spin 0.7s linear infinite; }
@keyframes balance-refresh-spin { to { transform: rotate(360deg); } }

.user-chip {
    display: inline-flex;
    height: 40px;
    align-items: center;
    gap: 9px;
    padding: 0 13px 0 6px;
    color: #dcecff;
    border: 1px solid rgba(148, 180, 224, 0.14);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.user-chip-avatar {
    display: inline-flex;
    width: 29px;
    height: 29px;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border-radius: 9px;
    background: linear-gradient(135deg, #46a8ff, #625cff);
    box-shadow: 0 7px 16px rgba(70, 168, 255, 0.2);
    font-size: 12px;
}

.modern-logout-form { display: flex; margin: 0; padding: 0; }

.modern-logout {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #a8b9ca;
    cursor: pointer;
    border: 1px solid rgba(255, 117, 139, 0.16);
    border-radius: 13px;
    outline: none;
    background: rgba(255, 117, 139, 0.055);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.modern-logout:hover {
    color: #ff9aaa;
    border-color: rgba(255, 117, 139, 0.38);
    background: rgba(255, 117, 139, 0.12);
    box-shadow: 0 8px 20px rgba(255, 80, 110, 0.12);
    transform: translateY(-1px);
}

.modern-logout:active { transform: scale(0.94); }

/* ================= 主体（tab + iframe） ================= */
.main-layout-body {
    position: absolute !important;
    top: var(--app-header) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: auto !important;
    padding: 0 !important;
    background: radial-gradient(circle at 100% 0, rgba(110, 92, 255, .08), transparent 30rem), #081322 !important;
}

.tab-title {
    display: flex;
    height: var(--app-tabs) !important;
    padding: 7px 16px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid var(--app-border) !important;
    background: rgba(10, 23, 39, .94) !important;
    align-items: flex-end;
    gap: 6px;
    margin: 0;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-title::-webkit-scrollbar { display: none; }

.tab-title li {
    height: 34px !important;
    padding: 0 15px !important;
    color: #7792aa;
    font-size: 13px;
    font-weight: 700;
    line-height: 34px !important;
    border: 0 !important;
    border-radius: 10px 10px 0 0;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.tab-title li:hover { color: #dceeff; background: rgba(255, 255, 255, .035); }
.tab-title li.active { color: #fff !important; background: rgba(57, 167, 255, .10) !important; }

.tab-title li .tab-close {
    position: relative;
    width: 12px;
    height: 12px;
    opacity: .55;
    flex: 0 0 12px;
}
.tab-title li .tab-close::before, .tab-title li .tab-close::after {
    position: absolute;
    top: 5px;
    left: 0;
    width: 12px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    content: "";
}
.tab-title li .tab-close::before { transform: rotate(45deg); }
.tab-title li .tab-close::after { transform: rotate(-45deg); }
.tab-title li .tab-close:hover { opacity: 1; color: #ff9daf; }
.tab-title li.home-tab .tab-close { display: none; }

.tab-content { height: calc(100% - var(--app-tabs)) !important; min-height: 0; padding: 0 !important; background: #081322 !important; }

.tab-pane { display: none; height: 100% !important; background: #081322 !important; }
.tab-pane.active { display: block; }

.tab-pane iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    background: #081322;
}

.main-mask {
    position: fixed !important;
    z-index: 1001 !important;
    inset: 0 !important;
    display: none;
    background: rgba(1, 8, 16, .68) !important;
    backdrop-filter: blur(3px);
}

/* 收合状态 */
.modern-nav-collapsed .main-layout-side { width: 78px !important; }
.modern-nav-collapsed .main-layout-container { margin-left: 78px !important; }
.modern-nav-collapsed .sidebar-brand { padding: 0 18px; }
.modern-nav-collapsed .sidebar-brand-copy,
.modern-nav-collapsed .hidden-folded,
.modern-nav-collapsed .side-nav .nav-more,
.modern-nav-collapsed .side-nav .nav-child { display: none !important; }

.modern-nav-collapsed .side-nav .nav-item > a {
    overflow: hidden;
    padding: 0 13px !important;
    font-size: 0;
    white-space: nowrap;
    justify-content: center;
}

.modern-nav-collapsed .side-nav .nav-item > a > i { width: 24px; margin: 0; font-size: 17px; }

/* ================= 移动端 ================= */
@media (max-width: 860px) {
    .main-layout-side {
        width: min(86vw, var(--app-sidebar)) !important;
        transform: translateX(-102%);
    }
    .main-layout-container, .modern-nav-collapsed .main-layout-container { margin-left: 0 !important; }
    .modern-mobile-open .main-layout-side { transform: translateX(0); }
    .modern-mobile-open .main-mask { display: block !important; }
    .main-layout-header { padding: 0 14px !important; }
    .modern-topbar-copy { display: none; }
    .modern-topbar-actions { flex: 1 1 auto; justify-content: flex-end; min-width: 0; gap: 8px; }
    .user-chip > span:last-child { display: none; }
    .user-chip { width: 40px; padding: 0; justify-content: center; }
}

@media (max-width: 600px) {
    :root { --app-header: 66px; --app-tabs: 44px; }
    .main-layout-header .sidebar-toggle-button, .modern-logout, .user-chip { width: 38px; height: 38px; border-radius: 11px; }
    .sidebar-toggle-icon { width: 21px; height: 21px; }
    .balance-chip { height: 38px; padding: 0 6px 0 9px; gap: 5px; }
    .balance-chip > span:not(#lbl_MyBalance) { display: none; }
    .balance-chip > strong, .balance-chip #lbl_MyBalance { display: inline-flex !important; }
    .balance-refresh { width: 27px; height: 27px; }
}
