/* ============================================================
   shell.css — 集团四系统共用外壳（2026-11-06）
   ============================================================
   【地位】本文件与 tokens.css 同为**单一真源**，四系统统一引用。
   巡店 / 培训 / 经营分析 / 智慧采购 **不再各自维护一套外壳 CSS**。

   【外壳契约（DOM 约定）】
   任何系统接入本外壳，只需把外壳节点挂上以下类名：

     <div class="shell">
       <header class="shell-top">
         <div class="shell-brand">…品牌名…<small>副标题</small></div>
         <div class="shell-top-actions">…账号区…</div>
       </header>
       <nav class="shell-nav">                      ← 横向一级分组页签
         <button class="shell-nav-item on">…</button>
       </nav>
       <div class="shell-body">
         <aside class="shell-side">
           <div class="shell-side-tools">…搜索等…</div>
           <nav class="shell-side-list">…二级菜单…</nav>
         </aside>
         <main class="shell-main">
           <div class="shell-page-head">…页面标题…</div>
           <div class="shell-content">…业务内容…</div>
         </main>
       </div>
     </div>

   业务页面只依赖 `.shell-content`（或自己的 #content 容器），
   外壳改造**不触碰任何业务 DOM**。

   【纪律】
   ⛔ 各系统本地 CSS 不得再重写外壳几何（顶栏高/侧栏宽/页签高/留白）。
   ⛔ 各系统本地 CSS 不得再自定义「导航条颜色/选中态」等外壳观感。
   ✅ 只允许写**本系统独有**的业务组件样式。
   ============================================================ */

/* ============================================================
   一、外壳骨架
   ============================================================ */
.shell{
  display:flex;flex-direction:column;min-height:100vh;
  background:var(--bg);
}
.shell-body{
  display:flex;flex:1;align-items:stretch;min-height:0;
  /* 顶栏 + 横向页签两条固定高度 */
  min-height:calc(100vh - var(--shell-body-top, 100px));
}
.shell-main{
  flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;
}
.shell-content{
  flex:1;overflow:auto;
  padding:var(--shell-content-pad, 14px 22px 22px);
}
/* 变体：内容随整页滚动（不设内部滚动容器）。
   适用：考试/长表单等依赖 window.scrollTo 与页面级 sticky 的页面。
   ⛔ 用它就必须把内部 sticky 的 top 改成 var(--shell-body-top)。 */
.shell-content.flow{overflow:visible;flex:0 0 auto}

/* ============================================================
   二、顶栏（白底品牌栏）
   ============================================================ */
.shell-top{
  height:var(--shell-top-h);flex:0 0 var(--shell-top-h);
  background:#fff;border-bottom:1px solid var(--line);
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:0 22px;box-shadow:var(--sh-1);
  position:sticky;top:0;z-index:var(--shell-z-top);
}
.shell-brand{
  display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;
  font-size:16px;font-weight:700;color:var(--ink);
}
.shell-brand small{font-size:12px;font-weight:400;color:var(--sub)}
.shell-top-actions{
  display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  color:var(--muted);font-size:13px;
}
.shell-top-actions b{color:var(--ink);font-weight:600}

/* ============================================================
   三、横向一级分组页签（智慧采购首创，巡店/培训新增）
   ============================================================ */
.shell-nav{
  height:var(--shell-nav-h);flex:0 0 var(--shell-nav-h);
  background:#fff;border-bottom:1px solid var(--line);
  display:flex;align-items:stretch;padding:0 14px;
  position:sticky;top:var(--shell-top-h);z-index:var(--shell-z-nav);
  overflow-x:auto;scrollbar-width:none;
}
.shell-nav::-webkit-scrollbar{display:none}
.shell-nav-item{
  display:flex;align-items:center;gap:6px;
  padding:0 18px;color:var(--muted);
  font-size:14px;font-weight:500;font-family:inherit;
  background:transparent;border:none;border-bottom:3px solid transparent;
  white-space:nowrap;cursor:pointer;
}
.shell-nav-item:hover{color:var(--ink);background:var(--bg-2)}
.shell-nav-item.on{
  color:var(--brand);border-bottom-color:var(--brand);font-weight:700;
}
.shell-nav-ico{
  width:16px;height:16px;flex:none;
  display:inline-flex;align-items:center;justify-content:center;
}
.shell-nav-ico svg{width:16px;height:16px;display:block}
/* 计数徽标：显示该分组下的可见功能数 */
.shell-nav-count{
  font-size:11px;line-height:16px;color:var(--sub);
  background:var(--surface-3);border-radius:var(--r-pill);padding:0 6px;
}
.shell-nav-item.on .shell-nav-count{background:var(--brand-soft);color:var(--brand)}

/* ============================================================
   四、左侧二级菜单
   ============================================================ */
.shell-side{
  width:var(--shell-side-w);flex:0 0 var(--shell-side-w);
  background:#fff;border-right:1px solid var(--line);
  display:flex;flex-direction:column;
  overflow-y:auto;overflow-x:hidden;
  position:sticky;top:var(--shell-body-top, 100px);
  height:calc(100vh - var(--shell-body-top, 100px));
  transition:width .22s ease,flex-basis .22s ease;
}
/* 侧栏折叠（可选能力）：给 .shell 加 .side-collapsed 即可收起左侧栏。
   折叠手柄按钮 .shell-side-toggle 贴在侧栏右缘，收起后贴到屏幕左缘。 */
.shell.side-collapsed .shell-side{width:0;flex:0 0 0;overflow:hidden;border-right:none}
.shell-side-toggle{
  position:fixed;top:calc(var(--shell-body-top,100px) + 8px);
  left:var(--shell-side-w);z-index:var(--shell-z-top);
  width:18px;height:46px;background:#fff;
  border:1px solid var(--line);border-left:none;border-radius:0 8px 8px 0;
  display:flex;align-items:center;justify-content:center;
  color:var(--brand);cursor:pointer;font-size:13px;line-height:1;
  box-shadow:var(--sh-1);transition:left .22s ease;user-select:none;
}
.shell.side-collapsed .shell-side-toggle{left:0}
.shell-side-toggle:hover{background:var(--side-hover)}
.shell-side-tools{
  flex:0 0 auto;position:relative;padding:12px 14px 8px;
}
.shell-side-list{flex:1;overflow:visible;padding:6px 0}
/* 二级菜单项：四系统统一观感（左侧蓝色高亮条 + 浅蓝底） */
.shell-side-item{
  display:flex;align-items:center;gap:10px;
  padding:9px 16px;color:var(--sub);
  font-size:13.5px;cursor:pointer;
  border-left:3px solid transparent;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
/* 菜单项文字：长标题在侧栏里截断并悬停看全名（四系统统一，勿在本地重复定义） */
.shell-side-item .lb{
  flex:1;min-width:0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
/* 以 <button> 承载菜单项时（培训系统），清掉浏览器默认按钮外观 */
button.shell-side-item{
  font-family:inherit;text-align:left;width:100%;
  border:none;border-left:3px solid transparent;
  background:transparent;box-shadow:none;
}
button.shell-side-item.on{border-left-color:var(--brand)}
.shell-side-item:hover{background:var(--side-hover);color:var(--ink)}
.shell-side-item.on{
  background:var(--brand-soft);border-left-color:var(--brand);
  color:var(--brand);font-weight:600;
}
/* 分组小标题（侧栏内二级分组） */
.shell-side-group{
  padding:10px 16px 6px;font-size:11px;font-weight:600;
  color:var(--sub);letter-spacing:.5px;
}

/* ============================================================
   五、内容区页标题
   ============================================================ */
.shell-page-head{
  flex:0 0 auto;padding:16px 22px 0;
  font-size:17px;font-weight:700;color:var(--ink);
}
.shell-page-head:empty{display:none}

/* ============================================================
   六、窄屏适配（顶栏与页签保持可见，侧栏回落为横向滚动）
   ============================================================ */
@media(max-width:880px){
  .shell-top{padding:0 12px}
  .shell-brand small{display:none}
  .shell-body{flex-direction:column;min-height:0}
  .shell-side{
    width:100%;flex:0 0 auto;height:auto;max-height:40vh;
    border-right:none;border-bottom:1px solid var(--line);
    position:static;
  }
  .shell-page-head{padding:14px 12px 0}
  .shell-content{padding:12px 12px 20px}
}
