/*
 * 后台框架层: 顶栏 / 侧边栏 / 工作台 / 使用手册弹窗
 * 规格取自设计稿 Frame22 (docs/新后台样式接入设计方案.md 第二、三、四节)
 * 手机端覆盖规则在 responsive.css
 */

/* ---------- 顶栏 ---------- */
.app-shell { height: 100vh; display: flex; flex-direction: column; background: var(--c-bg); }

.topbar { height: var(--header-h); flex: none; position: relative; z-index: 10; display: flex; align-items: center;
  gap: var(--sp-2); padding: 0 var(--sp-5); background: rgba(255, 255, 255, .93); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-line); box-shadow: var(--shadow-header); }
.brand { display: flex; align-items: center; gap: var(--sp-2); height: 52px; flex: none; }
.brand-logo { width: 52px; height: 52px; border-radius: var(--r-1); display: block; }
.brand-name { font-size: 26px; font-weight: 700; color: var(--c-text); white-space: nowrap; }
.brand-sub { width: auto; text-align: left; font-size: 14px; font-weight: 500; color: var(--c-text-3); white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); flex: none; margin-left: auto; }
.topbar-btn { height: 36px; padding: 0 16px; border-radius: var(--r-1); font-size: 13px; font-weight: 600; }
.topbar-btn.el-button + .el-button { margin-left: 0; }

/* ☰ / 页面名: 仅手机顶栏使用 (responsive.css 里显示) */
.menu-btn, .page-title { display: none; }

/* 顶栏用户信息 (头像 + 姓名 + 角色) */
.user-menu { display: flex; flex: none; }
.user-menu-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px;
  border: 0; background: transparent; border-radius: var(--r-1); font-family: inherit; cursor: pointer; }
.user-menu-btn:hover { background: var(--c-bg); }
.user-menu-btn:focus-visible { outline: 2px solid var(--c-primary); }
.side-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--c-primary); color: #fff;
  font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.user-menu-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.25; }
.user-menu-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--c-text); }
.user-menu-role { font-size: 11px; color: var(--c-text-3); }

/* ---------- 侧边栏 ---------- */
.layout { flex: 1; min-height: 0; display: flex; padding-left: 10px; }
.sidebar { width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; gap: var(--sp-1);
  padding: 12px; background: var(--c-card); overflow-y: auto; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: var(--sp-1); }
.side-group { padding: 8px 10px 2px; font-size: 12px; color: var(--c-text-3); white-space: nowrap; }
.side-item { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; border-radius: var(--r-2);
  font-size: 14px; color: var(--c-text-2); cursor: pointer; user-select: none; white-space: nowrap; overflow: hidden; }
.side-item span:not(.side-icon) { overflow: hidden; text-overflow: ellipsis; }
.side-item:hover { background: var(--c-bg); color: var(--c-text); }
.side-item.active { background: var(--c-primary-tint); color: var(--c-primary); font-weight: 600; }
.side-icon { width: 18px; height: 18px; flex: none; display: block; color: var(--c-text-3); }
.side-item.active .side-icon { color: var(--c-primary); }
.side-icon svg { width: 18px; height: 18px; display: block; }

/* 模块头 (可折叠) */
.side-module { display: flex; flex-direction: column; gap: var(--sp-1); }
.side-module-head { display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 10px;
  border: 0; background: transparent; border-radius: var(--r-2); font-family: inherit; font-size: 14px;
  font-weight: 600; color: var(--c-text-2); text-align: left; cursor: pointer; user-select: none; }
.side-module-head:hover { background: var(--c-bg); color: var(--c-text); }
.side-module-head.active { color: var(--c-primary); }
.side-module-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-module-caret { flex: none; font-size: 12px; color: var(--c-text-3); transition: transform .15s; }
.side-module-head.open .side-module-caret { transform: rotate(90deg); }
/* 模块内子项: 比模块头再缩进一级 */
.side-item--sub { padding-left: 18px; }

/* ---------- 内容区 ---------- */
.main-content { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 24px 28px 32px; }

/* ---------- 工作台 ---------- */
.wb-head { display: flex; align-items: center; min-height: 60px; margin-bottom: var(--sp-5); }
.wb-title { margin: 0; font-size: 28px; font-weight: 700; color: var(--c-text); white-space: nowrap; }
.wb-role { margin-left: var(--sp-3); height: 28px; padding: 0 14px; display: inline-flex; align-items: center;
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r-1); font-size: 18px;
  color: var(--c-text-role); white-space: nowrap; }
.wb-spacer { flex: 1; min-width: 0; }
.wb-corp { margin-right: var(--sp-5); font-size: 18px; color: var(--c-text-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.wb-plan { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
.wb-pill { height: 36px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: var(--r-1);
  background: var(--c-primary-soft); border: 1px solid var(--c-line); font-size: 13px; color: var(--c-text);
  white-space: nowrap; font-family: inherit; }
.wb-pill--btn { cursor: pointer; }
.wb-pill--btn:hover { border-color: var(--c-primary); }

.wb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.wb-card { min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-3);
  padding: 20px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r-3);
  box-shadow: var(--shadow-card); }
.wb-card-label { font-size: 13px; font-weight: 500; color: var(--c-text-2); }
.wb-card-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.wb-card-value { font-size: 28px; line-height: 36px; font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; }
.wb-card-value.warn { color: var(--c-warning); }
.wb-card--todo { cursor: pointer; transition: border-color .15s; }
.wb-card--todo:hover { border-color: var(--c-primary); }

/* ---------- 使用手册弹窗 (复用 kb-help 组件) ---------- */
.el-dialog.manual-dialog { height: 88vh; margin-top: 6vh; margin-bottom: 6vh; display: flex; flex-direction: column; }
.manual-dialog .el-dialog__body { flex: 1; min-height: 0; padding: 0; display: flex; flex-direction: column; }
.manual-dialog .kb-help { flex: 1; min-height: 0; align-items: stretch; border: 0; box-shadow: none; border-radius: 0; }
.manual-dialog .kb-help-pane, .manual-dialog .kb-help-toc-pane { max-height: none; height: auto; position: static; }
