/* ============================================================
 * shell.css —— 新壳层（2026-10-10 WebUI 重构 P1）
 * 两级导航 / 折叠记忆 / 菜单过滤 / 图标栏收起 / 面包屑 / 顶栏身份区。
 * 加载顺序在 style.css 之后：壳层选择器同名覆盖，页面内容样式不动。
 * ============================================================ */

/* ---------- 布局骨架微调 ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--nav-w); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #FFFFFF 0%, var(--g1) 100%);
  border-right: 1px solid var(--g3);
  transition: width .18s ease;
  overflow: hidden;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { max-width: 1480px; width: 100%; }

/* ---------- 品牌区 + 收起按钮 ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.brand .logo {
  flex: none; width: 38px; height: 38px; border-radius: 10px;
  background: var(--p-500); color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-1);
}
.brand-txt { min-width: 0; flex: 1; }
.nav-rail-btn {
  flex: none; width: 24px; height: 24px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--g4); background: var(--g0); color: var(--g5);
  font-size: 12px; line-height: 1; transition: transform .18s ease;
}
.nav-rail-btn:hover { color: var(--p-500); border-color: var(--p-300); }

/* ---------- 菜单过滤框 ---------- */
.nav-filter { padding: 2px 14px 8px; }
.nav-filter input {
  width: 100%; box-sizing: border-box; padding: 6px 10px;
  border: 1px solid var(--g4); border-radius: 8px; background: var(--g0);
  font: inherit; font-size: var(--fs-13); color: var(--g7);
}
.nav-filter input:focus { outline: none; border-color: var(--p-300); box-shadow: 0 0 0 3px var(--p-50); }
.nav-filter input::placeholder { color: var(--g5); }

/* ---------- 两级导航 ---------- */
#nav { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
#nav::-webkit-scrollbar { width: 4px; }
#nav::-webkit-scrollbar-thumb { background: var(--g4); border-radius: 2px; }

.nav-i {   /* 二级叶子（含直达页） */
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 14px; margin: 1px 0;
  border-radius: 8px; cursor: pointer; color: var(--g6);
  font-size: var(--fs-13); line-height: 1.35; position: relative;
  transition: background .12s ease, color .12s ease;
}
.nav-i:hover { background: var(--g2); color: var(--g7); }
.nav-i.on { background: var(--p-50); color: var(--p-700); font-weight: 600; }
.nav-i.on::before {
  content: ''; position: absolute; left: 4px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 2px; background: var(--p-500);
}
.nav-i .tx { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-i.nav-direct { font-weight: 600; color: var(--g7); padding-left: 10px; }
.nav-i.nav-direct .ic { margin-right: 2px; }
.nav-i .ic { flex: none; display: inline-flex; width: 18px; height: 18px; color: inherit; }
.nav-i .ic svg { width: 100%; height: 100%; }

/* 一级分组 */
.nav-grp { margin: 2px 0; }
.nav-grp-hd {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; font: inherit; font-size: var(--fs-13);
  font-weight: 600; color: var(--g7); text-align: left;
  transition: background .12s ease;
}
.nav-grp-hd:hover { background: var(--g2); }
.nav-grp-hd .ic { flex: none; display: inline-flex; width: 18px; height: 18px; color: var(--g5); }
.nav-grp-hd .ic svg { width: 100%; height: 100%; }
.nav-grp.open > .nav-grp-hd .ic { color: var(--p-500); }
.nav-grp-hd .tx { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-grp-hd .chev {
  flex: none; color: var(--g5); font-size: 12px; transition: transform .16s ease;
  transform: rotate(0deg);
}
.nav-grp.open > .nav-grp-hd .chev { transform: rotate(90deg); }
.nav-sub {
  display: none; margin: 1px 0 4px 15px;
  border-left: 1px solid var(--g3); padding-left: 4px;
}
.nav-grp.open > .nav-sub { display: block; }
.nav-sub .nav-i { padding-left: 10px; }
.nav-sub .nav-i.on::before { left: 1px; }

/* 角标（叶子计数 + 分组汇总共用形态） */
.badge {
  flex: none; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 2px;
  border-radius: 8px; font-size: 11px; font-weight: 700; line-height: 16px;
  text-align: center; color: #fff; background: var(--err);
}
.badge.b2 { background: var(--warn); color: #fff; }
.badge.b3 { background: var(--g5); }
.nav-empty { padding: 14px 16px; font-size: var(--fs-13); color: var(--g5); display: none; }

/* ---------- 图标栏（收起态）---------- */
body.nav-rail .sidebar { width: var(--nav-rail-w); }
body.nav-rail .brand { flex-direction: column; gap: 6px; padding: 12px 0; }
body.nav-rail .brand-txt,
body.nav-rail .nav-filter,
body.nav-rail .nav-grp-hd .tx,
body.nav-rail .nav-grp-hd .chev,
body.nav-rail .nav-i .tx,
body.nav-rail .sb-foot .st,
body.nav-rail .sb-foot .sf-note,
body.nav-rail .sb-foot .sf-icp { display: none; }
/* 特异性必须压过「.nav-grp.open > .nav-sub」——否则收起态下展开组的子项仍会渲染，
   留下无文字的激活胶囊残影（P1 验收实测） */
body.nav-rail .nav-grp > .nav-sub { display: none; }
body.nav-rail .nav-grp-hd { justify-content: center; padding: 9px 0; }
body.nav-rail .nav-i { justify-content: center; padding: 9px 0; }
body.nav-rail .nav-rail-btn { transform: rotate(180deg); }
body.nav-rail .sb-foot { align-items: center; }
body.nav-rail .nav-grp-hd .ic, body.nav-rail .nav-i .ic { width: 20px; height: 20px; }

/* ---------- 顶栏：面包屑 + 身份区 ---------- */
.topbar { align-items: flex-start; gap: 12px; }
.tb-left { min-width: 0; }
.tb-right { align-items: center; flex: none; flex-wrap: nowrap; }
.tb-right .bannerstrip, .tb-right .clock { flex: none; }
.search { flex: none; }
.search button { white-space: nowrap; flex: none; }
.crumb {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-12); color: var(--g5); margin-bottom: 2px;
  min-height: 16px;
}
.crumb .c-g { color: var(--g5); cursor: pointer; }
.crumb .c-g:hover { color: var(--p-500); }
.crumb .c-sep { color: var(--g4); }
.crumb .c-cur { color: var(--g6); }
#pgTitle { margin-top: 0; }
.tb-right { align-items: center; }
.idchip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 5px 12px; border: 1px solid var(--g4); border-radius: 999px;
  background: var(--g0); font-size: var(--fs-13); color: var(--g6);
  white-space: nowrap; transition: border-color .12s ease, color .12s ease;
}
.idchip:hover { border-color: var(--p-300); color: var(--p-700); }
.idchip .id-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g5); }
.idchip.logged .id-dot { background: var(--ok); }

/* ---------- 响应式：窄屏默认收起（按钮可再展开）---------- */
@media (max-width: 1280px) {
  .g6 { grid-template-columns: repeat(3, 1fr); }
  .g4 { grid-template-columns: repeat(2, 1fr); }
}
