/* ============================================================
   app-shell.css 全站页面骨架（管理端 + 用户端唯一来源）
   ------------------------------------------------------------
   结构（两端完全一致，禁止各自实现一套导航骨架）：

     .app-shell
       ├─ .app-aside            固定侧栏：Logo + 菜单分组 + 底部用户
       └─ .app-main
            ├─ .app-topbar      折叠/汉堡 + 页面标题 + 右侧操作区
            └─ .app-content     页面内容

   PC（≥992px）  侧栏常驻，可折叠为 64px 纯图标栏
   移动（<992px）侧栏隐藏，顶栏汉堡打开抽屉 .app-menu-drawer
   ============================================================ */

.app-shell { min-height: 100vh; }

/* ---------------- 侧栏 ---------------- */
.app-aside {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--app-aside-w);
  background: var(--app-card-bg);
  border-right: 1px solid var(--app-border-light);
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: width .22s ease;
}
.app-aside.is-mini { width: var(--app-aside-w-mini); }
.app-aside-hd {
  height: var(--app-topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--sp-3) 0 18px;
  border-bottom: 1px solid var(--app-border-light);
  flex: 0 0 auto;
}
.app-logo {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  object-fit: cover;
  flex: 0 0 32px;
  border: 1px solid var(--app-border-light);
}
.app-logo-ph {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--app-primary), #5b8bff);
  color: #fff; font-size: 15px; font-weight: 700;
  border: 0;
}
.app-aside-name {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600; color: var(--app-text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-aside-collapse {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--app-text-3);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.app-aside-collapse:hover { background: #f2f3f5; color: var(--app-text-1); }
.app-aside-bd { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-2) 0 var(--sp-4); }

/* 菜单 */
.app-nav-group {
  padding: var(--sp-3) 18px var(--sp-1);
  font-size: 12px;
  color: var(--app-text-3);
  letter-spacing: .02em;
  white-space: nowrap;
}
.app-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 10px;
  padding: 0 var(--sp-3);
  height: 40px;
  border-radius: var(--r-md);
  color: var(--app-text-2);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.app-nav-item svg { flex: 0 0 auto; }
.app-nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app-nav-item:hover { background: #f5f6f8; color: var(--app-text-1); }
.app-nav-item:focus-visible { outline: 2px solid var(--app-primary-border); outline-offset: 1px; }
.app-nav-item.active {
  background: var(--app-primary-weak);
  color: var(--app-primary);
  font-weight: 600;
}
.app-nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px; top: 9px;
  width: 3px; height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--app-primary);
}
.app-nav-item .badge {
  flex: 0 0 auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--app-danger-weak);
  color: var(--app-danger);
  font-size: 11px; font-weight: 600; line-height: 18px;
  text-align: center;
}
.app-aside.is-mini .app-nav-group { text-align: center; padding: var(--sp-3) 0 var(--sp-1); }
.app-aside.is-mini .app-nav-group span { display: none; }
.app-aside.is-mini .app-nav-item { justify-content: center; padding: 0; margin: 2px var(--sp-3); }
.app-aside.is-mini .app-nav-item .label,
.app-aside.is-mini .app-nav-item .badge { display: none; }
.app-aside.is-mini .app-nav-item.active::before { display: none; }

/* 侧栏底部用户 */
.app-aside-ft {
  flex: 0 0 auto;
  padding: 10px var(--sp-3) 14px;
  border-top: 1px solid var(--app-border-light);
}
.app-aside-user {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 13px; color: var(--app-text-2);
  min-width: 0;
}
.app-aside-user .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-aside.is-mini .app-aside-user { justify-content: center; }
.app-aside.is-mini .app-aside-user .name { display: none; }

/* ---------------- 主区域 ---------------- */
.app-main {
  margin-left: var(--app-aside-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .22s ease;
}
.app-main.is-mini { margin-left: var(--app-aside-w-mini); }

/* 顶栏 */
.app-topbar {
  position: sticky; top: 0; z-index: 80;
  height: var(--app-topbar-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-border-light);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-6);
}
.app-topbar-title {
  font-size: 16px; font-weight: 600; color: var(--app-text-1);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-topbar-right { display: flex; align-items: center; gap: var(--sp-2); }
/* 顶栏图标按钮（展开/收起、汉堡）：同尺寸同圆角同悬浮 */
.app-collapse,
.app-burger {
  display: none;
  width: 34px; height: 34px;
  flex: 0 0 34px;
  align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: var(--app-text-2);
  cursor: pointer;
  font-size: 18px;
  transition: background var(--t-fast), color var(--t-fast);
}
.app-collapse { display: flex; }
.app-collapse:hover,
.app-burger:hover { background: #f2f3f5; color: var(--app-text-1); }
.app-topbar-user {
  display: flex; align-items: center; gap: var(--sp-2);
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.app-topbar-user:hover { background: #f5f6f8; }
.app-topbar-user .uname {
  font-size: 13px; color: var(--app-text-2); max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 内容区 */
.app-content { flex: 1; padding: var(--sp-5) var(--sp-6) 48px; width: 100%; min-width: 0; }

/* ---------------- 头像（统一主色浅底） ----------------
   自建 span 用固定尺寸；Element Plus 的 el-avatar 保留其自身 :size 设置（内联 --el-avatar-size 优先）。
   ---------------------------------------------------- */
.app-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  background: var(--app-primary-weak);
  color: var(--app-primary);
  font-size: 13px; font-weight: 600;
  flex: 0 0 auto;
  overflow: hidden;
}
.app-avatar:not(.el-avatar) { width: 28px; height: 28px; }
.app-avatar.sm:not(.el-avatar) { width: 26px; height: 26px; font-size: 12px; }
.app-avatar.lg:not(.el-avatar) { width: 40px; height: 40px; font-size: 17px; }
.app-avatar.el-avatar.lg { font-size: 18px; font-weight: 600; }

/* ---------------- 内容区滚动条 ---------------- */
.app-content::-webkit-scrollbar,
.app-aside-bd::-webkit-scrollbar { width: var(--sp-2); height: var(--sp-2); }
.app-aside-bd::-webkit-scrollbar { width: var(--r-xs); }
.app-content::-webkit-scrollbar-thumb,
.app-aside-bd::-webkit-scrollbar-thumb { background: #d8dbe0; border-radius: var(--r-xs); }
.app-content::-webkit-scrollbar-thumb:hover,
.app-aside-bd::-webkit-scrollbar-thumb:hover { background: #c3c7cd; }
.app-content::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 响应式：移动端改为抽屉导航 ---------------- */
@media (max-width: 991.98px) {
  .app-aside { display: none; }
  .app-main,
  .app-main.is-mini { margin-left: 0; }
  .app-content { padding: var(--sp-4) var(--sp-4) 40px; }
  .app-collapse { display: none; }
  .app-burger { display: flex; }
  .app-topbar { padding: 0 var(--sp-3); }
  .app-topbar-user .uname { display: none; }
}
