/* ═══════════════════════════════════════════════════════════════════════════
   X-UP 外壳骨架 v3（2026-10-02）
   目标：左侧宽栏 → 顶部一级 Tab + 56px 图标轨
   依据：.ui-preview/redesign20261001/v3/dashboard.html（用户确认的效果图）

   安全性设计：
   ① 不删除任何菜单 DOM —— 顶部 Tab 由 JS 从侧栏动态生成，权限 @if 自动继承
   ② 全部规则限定在 body.shell-v3 下 —— 删掉这个类即完整回滚
   ③ 不改 JS 逻辑 —— toggleNavGroup / applySidebar 原样保留
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 尺寸变量 ─────────────────────────────────────────────────────────── */
body.shell-v3 {
  --v3-tabbar-h: 56px;   /* 顶部条（品牌 + 一级模块 Tab + 右侧操作）*/
  --v3-rail-w: 76px;     /* 图标轨宽（二级页面：图标 + 一行小字）*/
}

/* ══════════════════════════════════════════════════════════════════════════
   1. 顶部一级 Tab 栏
   ══════════════════════════════════════════════════════════════════════════ */
body.shell-v3 .v3-tabbar {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  height: var(--v3-tabbar-h) !important;
  flex-wrap: nowrap !important;
  background: var(--v2-surface, #fff) !important;
  border-bottom: 1px solid var(--v2-border, #E9EBF2) !important;
  display: flex !important; align-items: center !important;
  padding: 0 18px !important; gap: 16px !important;
  z-index: 1040 !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.03) !important;
}
body.shell-v3 .v3-brand {
  display: flex !important; align-items: center !important; gap: 10px !important;
  padding-right: 16px !important; margin-right: 4px !important;
  border-right: 1px solid var(--v2-border, #E9EBF2) !important;
  text-decoration: none !important; flex: none !important;
}
body.shell-v3 .v3-brand img { height: 28px !important; width: auto !important; border-radius: 6px !important; }
body.shell-v3 .v3-brand b {
  font-size: 14px !important; font-weight: 650 !important; letter-spacing: -.015em !important;
  color: var(--pc-text, #171B2E) !important; white-space: nowrap !important;
}
body.shell-v3 .v3-tabs {
  display: flex !important; align-items: center !important; gap: 2px !important;
  height: 100% !important; overflow-x: auto !important; overflow-y: hidden !important;
  scrollbar-width: none !important; min-width: 0 !important;
}
body.shell-v3 .v3-tabs::-webkit-scrollbar { display: none !important; }
body.shell-v3 .v3-tab {
  display: flex !important; align-items: center !important; gap: 7px !important;
  height: 100% !important; padding: 0 14px !important;
  font-size: 14px !important; font-weight: 500 !important;
  color: var(--pc-text-sub, #5A6079) !important;
  text-decoration: none !important; position: relative !important;
  white-space: nowrap !important; flex: none !important;
  transition: color .15s ease !important;
}
body.shell-v3 .v3-tab:hover { color: var(--pc-text, #171B2E) !important; }
body.shell-v3 .v3-tab.on { color: var(--pc-primary, #2563EB) !important; font-weight: 600 !important; }
body.shell-v3 .v3-tab.on::after {
  content: "" !important; position: absolute !important;
  left: 14px !important; right: 14px !important; bottom: 0 !important;
  height: 2.5px !important; background: var(--pc-primary, #2563EB) !important;
  border-radius: 2px 2px 0 0 !important;
}
body.shell-v3 .v3-tab i { font-size: 15px !important; opacity: .9 !important; }
body.shell-v3 .v3-tabbar-end {
  display: flex !important; align-items: center !important; gap: 8px !important;
  margin-left: auto !important; padding-left: 14px !important;
  flex: none !important; height: 100% !important;
}
body.shell-v3 .v3-tabbar-end > * { flex: none !important; }
body.shell-v3 .v3-tabbar .v3-tabs { flex: 0 1 auto !important; }
body.shell-v3 .v3-tab.on i { opacity: 1 !important; }

@media (min-width: 993px) {
/* ══════════════════════════════════════════════════════════════════════════
   2. 原顶栏下移，成为工具行
   ══════════════════════════════════════════════════════════════════════════ */
body.shell-v3 .app-shell .topbar { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════════
   3. 侧栏 → 56px 图标轨
   ══════════════════════════════════════════════════════════════════════════ */
body.shell-v3 .app-shell .sidebar-shell,
body.shell-v3 body.sidebar-collapsed .app-shell .sidebar-shell {
  width: var(--v3-rail-w) !important;
  min-width: var(--v3-rail-w) !important;
  flex: 0 0 var(--v3-rail-w) !important;
  top: var(--v3-tabbar-h) !important;
  height: calc(100vh - var(--v3-tabbar-h)) !important;
  overflow: visible !important;
  z-index: 1025 !important;
  /* 覆盖 pc.css 的深蓝渐变：轨道与顶部 Tab 统一为浅色 */
  background: var(--v2-surface, #FFFFFF) !important;
  border-right: 1px solid var(--v2-border, #E9EBF2) !important;
  box-shadow: none !important;
  padding: 6px 0 !important;
}
body.shell-v3 .app-shell .sidebar-inner { padding: 6px 0 !important; overflow: hidden !important; }
body.shell-v3 .app-shell .sidebar-brand { display: none !important; }
body.shell-v3 .app-shell .sidebar-menu-scroll {
  overflow: visible !important; padding: 0 !important;
}
body.shell-v3 .app-shell .sidebar-menu { padding: 0 !important; }

/* ── 二级图标轨：原侧栏菜单隐藏，改由 JS 按「当前模块的二级页面」生成 ── */
body.shell-v3 .app-shell .sidebar-menu-scroll { display: none !important; }
body.shell-v3 .app-shell .v3-rail {
  flex: 1 1 auto !important; min-height: 0 !important; align-self: stretch !important;
  display: flex !important; flex-direction: column !important; align-items: center !important;
  gap: 6px !important; padding: 8px 0 12px !important;
  overflow-y: auto !important; overflow-x: hidden !important;
  scrollbar-width: none !important; -ms-overflow-style: none !important;
  background: transparent !important;
}
body.shell-v3 .app-shell .v3-rail::-webkit-scrollbar { display: none !important; width: 0 !important; }
body.shell-v3 .app-shell .v3-rail-item {
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  gap: 4px !important; flex: none !important;
  width: 68px !important; min-height: 50px !important; margin: 0 auto !important;
  padding: 8px 0 7px !important; border-radius: 11px !important;
  text-decoration: none !important; cursor: pointer !important;
  color: var(--pc-text-sub, #5A6079) !important;
  font-size: 11px !important; line-height: 1.1 !important; font-weight: 500 !important;
  letter-spacing: -.03em !important; white-space: nowrap !important;
  transition: background .15s ease, color .15s ease !important;
}
body.shell-v3 .app-shell .v3-rail-item i {
  font-size: 16px !important; width: 16px !important; height: 16px !important;
  line-height: 16px !important; text-align: center !important; opacity: .95 !important;
}
body.shell-v3 .app-shell .v3-rail-item span {
  max-width: 66px !important; overflow: hidden !important;
  text-overflow: ellipsis !important; display: block !important;
}
body.shell-v3 .app-shell .v3-rail-item:hover {
  background: var(--pc-bg, #F2F4F8) !important; color: var(--pc-text, #171B2E) !important;
}
body.shell-v3 .app-shell .v3-rail-item.on {
  background: var(--pc-primary-light, #EEF1FF) !important;
  color: var(--pc-primary, #2563EB) !important; font-weight: 650 !important;
}

/* 图标轨内的 nav-group：只显图标，垂直居中 */
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group { position: relative !important; margin: 0 !important; }
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-header {
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  gap: 3px !important;
  width: 48px !important; height: auto !important; min-height: 46px !important;
  margin: 1px auto !important;
  padding: 7px 0 6px !important; border-radius: 10px !important;
  border-left: 0 !important; background: transparent !important;
  color: var(--pc-text-sub, #5A6079) !important;
  cursor: pointer !important; transition: background .15s ease, color .15s ease !important;
  text-align: center !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-header:hover {
  background: var(--pc-bg, #F2F4F8) !important; color: var(--pc-text, #171B2E) !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group.open .nav-group-header,
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group.active-link .nav-group-header {
  background: var(--pc-primary-light, #EEF1FF) !important;
  color: var(--pc-primary, #2563EB) !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-icon {
  font-size: 16px !important; width: 16px !important; height: 16px !important;
  line-height: 16px !important; text-align: center !important;
  margin: 0 !important; opacity: 1 !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-text {
  display: block !important;
  font-size: 11px !important; line-height: 1 !important;
  font-weight: 500 !important; letter-spacing: -.03em !important;
  white-space: nowrap !important; max-width: 54px !important;
  overflow: hidden !important; text-overflow: clip !important;
  opacity: .92 !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group.open .nav-group-text,
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group.active-link .nav-group-text {
  font-weight: 650 !important; opacity: 1 !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-arrow { display: none !important; }
/* 兜底：任何可能残留的文字/箭头/徽标一律隐藏，避免竖排 */
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-header > .badge,
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-header > small { display: none !important; }
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-header { overflow: hidden !important; white-space: nowrap !important; }
/* 侧栏尾部（我的/收起等）在轨道里也隐藏 */
body.shell-v3 .app-shell .sidebar-inner > *:not(.sidebar-brand):not(.sidebar-menu-scroll):not(.v3-rail) { display: none !important; }
/* 轨道里可能出现的分组标题 */
body.shell-v3 .app-shell .sidebar-menu-scroll > .menu-label,
body.shell-v3 .app-shell .sidebar-menu-scroll > .sidebar-section-title,
body.shell-v3 .app-shell .sidebar-menu-scroll > .sidebar-caption { display: none !important; }
/* 兜底2：轨道内任意层级的 menu-label 都隐藏（原 DOM 里它们在 .sidebar-menu 内） */
body.shell-v3 .app-shell .sidebar-menu-scroll .menu-label,
body.shell-v3 .app-shell .sidebar-menu-scroll .sidebar-section-title,
body.shell-v3 .app-shell .sidebar-menu-scroll .sidebar-caption,
body.shell-v3 .app-shell .sidebar-menu-scroll .menu-group-title { display: none !important; }

/* 二级菜单：默认隐藏，hover 时浮出 */
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body {
  display: none !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group:hover .nav-group-body {
  display: block !important;
  position: absolute !important; left: calc(var(--v3-rail-w) - 6px) !important; top: 0 !important;
  min-width: 208px !important; background: var(--v2-surface, #fff) !important;
  border: 1px solid var(--v2-border, #E9EBF2) !important; border-radius: 12px !important;
  box-shadow: 0 8px 24px rgba(15,23,42,.14) !important;
  padding: 8px !important; z-index: 1060 !important;
  max-height: 70vh !important; overflow-y: auto !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group:hover .nav-group-body .sidebar-menu { padding: 0 !important; }
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body a {
  display: flex !important; align-items: center !important; gap: 9px !important;
  padding: 9px 12px !important; border-radius: 8px !important;
  font-size: 13.5px !important; color: var(--pc-text-sub, #5A6079) !important;
  text-decoration: none !important; border-left: 0 !important; white-space: nowrap !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body a:hover {
  background: var(--pc-bg, #F2F4F8) !important; color: var(--pc-text, #171B2E) !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body a.active,
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body a.active-link {
  background: var(--pc-primary-light, #EEF1FF) !important;
  color: var(--pc-primary, #2563EB) !important; font-weight: 600 !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body a i { width: 15px !important; text-align: center !important; opacity: .8 !important; }
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body .menu-label,
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group-body .sidebar-section-title {
  display: block !important; font-size: 11px !important; font-weight: 600 !important;
  color: var(--pc-text-muted, #94A3B8) !important; padding: 8px 12px 4px !important;
  letter-spacing: .06em !important; white-space: nowrap !important;
}

/* 轨道底部「我的」入口（侧栏尾部） */
body.shell-v3 .app-shell .sidebar-footer,
body.shell-v3 .app-shell .sidebar-user { display: none !important; }


/* ══════════════════════════════════════════════════════════════════════════
   3b. 兜底：nav-leaf 的子菜单是 .sidebar-menu（不是 .nav-group-body）
   —— 同样收纳进 hover 浮层，避免它在轨道里直接铺开
   ══════════════════════════════════════════════════════════════════════════ */
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group > .sidebar-menu { display: none !important; }
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu {
  display: block !important;
  position: absolute !important; left: calc(var(--v3-rail-w) - 6px) !important; top: 0 !important;
  min-width: 208px !important; background: var(--v2-surface, #fff) !important;
  border: 1px solid var(--v2-border, #E9EBF2) !important; border-radius: 12px !important;
  box-shadow: 0 8px 24px rgba(15,23,42,.14) !important;
  padding: 8px !important; z-index: 1060 !important;
  max-height: 70vh !important; overflow-y: auto !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu .menu-label,
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu a {
  display: flex !important; align-items: center !important; gap: 9px !important;
  padding: 9px 12px !important; border-radius: 8px !important;
  font-size: 13.5px !important; color: var(--pc-text-sub, #5A6079) !important;
  text-decoration: none !important; white-space: nowrap !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu a:hover {
  background: var(--pc-bg, #F2F4F8) !important; color: var(--pc-text, #171B2E) !important;
}
body.shell-v3 .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu a.active {
  background: var(--pc-primary-light, #EEF1FF) !important;
  color: var(--pc-primary, #2563EB) !important; font-weight: 600 !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu {
  background: #1F2630 !important; border-color: rgba(255,255,255,.10) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.5) !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu a:hover {
  background: rgba(255,255,255,.06) !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group:hover > .sidebar-menu a.active {
  background: rgba(96,165,250,.15) !important; color: #7CB3FF !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   4. 内容区上移、左移
   ══════════════════════════════════════════════════════════════════════════ */
body.shell-v3 .app-shell .shell-body {
  margin-left: var(--v3-rail-w) !important;
  margin-top: var(--v3-tabbar-h) !important;
  min-height: calc(100vh - var(--v3-tabbar-h)) !important;
}
body.shell-v3 body.sidebar-collapsed .app-shell .shell-body { left: var(--v3-rail-w) !important; }
body.shell-v3 main.content-shell {
  height: calc(100vh - var(--v3-tabbar-h)) !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   5. 深色模式
   ══════════════════════════════════════════════════════════════════════════ */
body.shell-v3[data-theme="dark"] .v3-tabbar {
  background: #1A2029 !important; border-bottom-color: rgba(255,255,255,.09) !important;
}
body.shell-v3[data-theme="dark"] .v3-brand { border-right-color: rgba(255,255,255,.09) !important; }
body.shell-v3[data-theme="dark"] .app-shell .topbar {
  background: #1A2029 !important; border-bottom-color: rgba(255,255,255,.09) !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-shell {
  background: #151B24 !important;
  border-right-color: rgba(255,255,255,.08) !important;
}
body.shell-v3[data-theme="dark"] .app-shell .v3-rail-item { color: #93A2BA !important; }
body.shell-v3[data-theme="dark"] .app-shell .v3-rail-item:hover { background: rgba(255,255,255,.07) !important; color: #E6EDF7 !important; }
body.shell-v3[data-theme="dark"] .app-shell .v3-rail-item.on { background: rgba(96,165,250,.16) !important; color: #7CB3FF !important; }
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group-header {
  color: #93A2BA !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group-header:hover {
  color: #E6EDF7 !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group-header:hover {
  background: rgba(255,255,255,.07) !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group.open .nav-group-header,
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group.active-link .nav-group-header {
  background: rgba(96,165,250,.16) !important; color: #7CB3FF !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group:hover .nav-group-body {
  background: #1F2630 !important; border-color: rgba(255,255,255,.10) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.5) !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group-body a:hover {
  background: rgba(255,255,255,.06) !important;
}
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group-body a.active,
body.shell-v3[data-theme="dark"] .app-shell .sidebar-menu-scroll .nav-group-body a.active-link {
  background: rgba(96,165,250,.15) !important; color: #60A5FA !important;
}

}

/* ══════════════════════════════════════════════════════════════════════════
   6. 响应式：≤992px 完全退回原侧栏布局
   说明：v3 骨架的「顶栏下移 / 图标轨 / 内容区偏移 / 深色轨道」全部包在
   min-width:993px 里，所以窄屏只需隐藏顶部 Tab 栏，其余沿用原样式。
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
  body.shell-v3 .v3-tabbar { display: none !important; }
  body.shell-v3 .app-shell .v3-rail { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   7. 「更多」菜单：把右上角一排小图标（大屏/驾驶舱/消息/皮肤/主题）收进一个按钮
   说明：只做收纳 + 弹出，内部控件原样搬运，点击/下拉逻辑不变。
   ══════════════════════════════════════════════════════════════════════════ */
body.shell-v3 .v3-more { position: relative !important; display: inline-flex !important; align-items: center !important; }
body.shell-v3 .v3-more-btn { display: inline-flex !important; align-items: center !important; justify-content: center !important; }
body.shell-v3 .v3-more-panel {
  position: absolute !important; top: calc(100% + 9px) !important; right: 0 !important;
  min-width: 214px !important; padding: 7px !important;
  background: var(--v2-surface, #fff) !important;
  border: 1px solid var(--v2-border, #E9EBF2) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16) !important;
  display: none !important; z-index: 1070 !important; overflow: visible !important;
}
body.shell-v3 .v3-more.open .v3-more-panel { display: block !important; }
body.shell-v3 .v3-more-panel .v3-more-item {
  width: 100% !important; height: auto !important; min-height: 38px !important;
  display: flex !important; align-items: center !important; justify-content: flex-start !important;
  gap: 10px !important; padding: 8px 10px !important; margin: 0 !important;
  border: 0 !important; border-radius: 9px !important; background: transparent !important;
  color: var(--pc-text-sub, #5A6079) !important;
  font-size: 13.5px !important; line-height: 1.2 !important; font-weight: 500 !important;
  text-decoration: none !important; white-space: nowrap !important; box-shadow: none !important;
}
body.shell-v3 .v3-more-panel .v3-more-item i {
  width: 17px !important; height: auto !important; line-height: 1 !important;
  font-size: 14px !important; text-align: center !important; flex: none !important;
}
body.shell-v3 .v3-more-panel .v3-more-label { display: inline !important; }
/* 皮肤那一行外层是 div.dropdown，真正可点的按钮在里面 —— 也要抹掉方框样式，改成整行 */
body.shell-v3 .v3-more-panel .skin-sw { width: 100% !important; display: block !important; }
body.shell-v3 .v3-more-panel .skin-sw > .topbar-btn {
  width: 100% !important; height: auto !important; min-height: 38px !important;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  display: flex !important; align-items: center !important; justify-content: flex-start !important;
  gap: 10px !important; padding: 8px 10px !important; border-radius: 9px !important;
  color: inherit !important; font-size: 13.5px !important; font-weight: 500 !important;
}
body.shell-v3 .v3-more-panel .skin-sw > .topbar-btn:hover {
  background: var(--pc-bg, #F2F4F8) !important;
}
body.shell-v3[data-theme="dark"] .v3-more-panel .skin-sw > .topbar-btn:hover {
  background: rgba(255,255,255,.07) !important;
}
body.shell-v3 .v3-more-panel .v3-more-item:hover {
  background: var(--pc-bg, #F2F4F8) !important; color: var(--pc-text, #171B2E) !important;
}
body.shell-v3 .v3-more-panel .notification-badge {
  position: static !important; margin-left: auto !important; transform: none !important;
}
/* 皮肤下拉在面板里向左展开，避免被右边界裁掉 */
body.shell-v3 .v3-more-panel .skin-menu { left: auto !important; right: 0 !important; }
/* 深色 */
body.shell-v3[data-theme="dark"] .v3-more-panel {
  background: #1F2630 !important; border-color: rgba(255,255,255,.10) !important;
  box-shadow: 0 12px 32px rgba(0,0,0,.55) !important;
}
body.shell-v3[data-theme="dark"] .v3-more-panel .v3-more-item { color: #A9B6CA !important; }
body.shell-v3[data-theme="dark"] .v3-more-panel .v3-more-item:hover {
  background: rgba(255,255,255,.07) !important; color: #E6EDF7 !important;
}
