/* ============================================================================
   慵懒半径 v2 · core.css（核心通用样式合并）
   ----------------------------------------------------------------------------
   合并自旧版：base / buttons / loading / toast / header / fab / image-viewer
   改造点：
     1. 删 32s 浮动光斑动画 → 静态 mesh gradient（决策17，省 CPU）
     2. 紫色阴影残留（rgba(79,70,229)）→ 珊瑚橙（rgba(249,115,22)）
     3. 桌面断点 900/1400 → 768/1024/1440 四档（决策16）
     4. 全部用新 token（--brand/--slate-*/--elev-*/--r-*/--sp-*/--fs-*）
  /*   5. 删 glass.css !important 覆盖层（新 token 干净，无需补丁）
     6. 保留双环旋转 loading（珊瑚橙+天蓝，用户偏好）
     7. 全局 loading 无文字右侧点动画（约束）
   ============================================================================ */

/* ========== 1. Reset ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;                              /* 显式覆盖 UA 默认 body margin: 8px */
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;  /* 数字等宽：执行分/次数对齐 */
}

/* 强制继承简体中文字体，防止系统回退到繁体字形 */
*, *::before, *::after {
  font-family: inherit;
}
input, button, select, textarea {
  font-family: var(--font-sans);
  box-sizing: border-box;       /* 覆盖 UA input 默认 content-box，避免 width:100%+padding 溢出 */
}

/* ========== 2. #app 容器（多层 radial-gradient + 光斑漂浮动画，旧版风格） ========== */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  /* 多层 radial-gradient 叠加底色（旧版青春活力配色） */
  background: var(--bg, #f8fafc);
  overflow: hidden;
  color: var(--text);
}
/* 光斑漂浮装饰（旧版风格，5 个光斑 + blur + 32s 浮动） */
#app::before {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background: none;
  filter: blur(12px);
  animation: orbsFloat 32s var(--ease-in-out) infinite alternate;
  z-index: 0;
}
@keyframes orbsFloat {
  0%   { transform: translate3d(0,0,0) rotate(0deg) scale(1); }
  50%  { transform: translate3d(-2%, 2%, 0) rotate(6deg) scale(1.04); }
  100% { transform: translate3d(2%, -1%, 0) rotate(-5deg) scale(1.02); }
}

/* ========== 3. 桌面端布局（≥768px 侧栏 + 主区） ========== */
@media (min-width: 768px) {
  html, body { height: 100vh; }
  #app {
    max-width: 100%;
    max-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 100vh;
    height: 100vh;
  }
}
@media (min-width: 1024px) {
  #app { grid-template-columns: var(--sidebar-w) 1fr; }
}
@media (min-width: 1440px) {
  #app {
    grid-template-columns: var(--sidebar-w) 1fr;
    max-width: var(--content-max);
  }
}

/* ========== 4. 页面容器 ========== */
.page {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  animation: pageIn var(--dur-3) var(--ease-out);
  z-index: 1;
  color: var(--text);
}
.page.active { display: flex; }

/* 桌面端：页面占满主区域，不再 absolute */
@media (min-width: 768px) {
  .page {
    position: relative;
    grid-column: 2;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }
  .login-page { grid-column: 1 / -1; }
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 顶部状态栏留白（iOS 安全区） */
.status-bar {
  flex: 0 0 auto;
  height: env(safe-area-inset-top, 0);
}

/* ========== 5. 滚动条美化 ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.28);
  border-radius: var(--r-xs);
}
::-webkit-scrollbar-thumb:hover { background: rgba(249, 115, 22, 0.48); }

::selection { background: rgba(249, 115, 22, 0.22); color: var(--text); }

/* ============================================================================
   6. 全局 Loading（双环旋转 + 珊瑚橙，保留用户偏好）
   ============================================================================ */
.global-loading {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-3) var(--ease-out);
}
.global-loading.show {
  opacity: 1;
  pointer-events: auto;
}

/* 卡片容器（扁平化，用 elev-4 阴影） */
.gl-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 30px 36px 26px;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--slate-200);
  box-shadow: var(--elev-4);
  transform: scale(0.9);
  opacity: 0;
  transition: transform var(--dur-3) var(--ease-spring), opacity var(--dur-3) var(--ease-out);
}
.global-loading.show .gl-card {
  transform: scale(1);
  opacity: 1;
}

/* 旋转器舞台 */
.gl-stage {
  position: relative;
  width: 64px;
  height: 64px;
}

/* 外环：珊瑚橙，顺时针 */
.gl-ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid rgba(249, 115, 22, 0.16);
  border-top-color: var(--brand);
  border-right-color: var(--brand-400);
  animation: gl-spin 0.95s linear infinite;
}

/* 内环：天蓝强调色，逆时针 */
.gl-ring-inner {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 3px solid rgba(14, 165, 233, 0.16);
  border-bottom-color: var(--accent);
  border-left-color: #38bdf8;
  animation: gl-spin-rev 0.7s linear infinite;
}

/* 核心小球：呼吸缩放 */
.gl-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
  animation: gl-pulse 1.1s var(--ease-in-out) infinite;
}

/* 轨道粒子：环绕飞行 */
.gl-orbit {
  position: absolute;
  inset: 0;
  animation: gl-spin 1.6s linear infinite;
}
.gl-orbit::before,
.gl-orbit::after {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--brand-400);
  box-shadow: 0 0 8px rgba(251, 146, 60, 0.8);
}
.gl-orbit::after {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.8);
  top: auto;
  bottom: -3px;
}

@keyframes gl-spin { to { transform: rotate(360deg); } }
@keyframes gl-spin-rev { to { transform: rotate(-360deg); } }
@keyframes gl-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

/* 文案（无右侧点动画，符合约束） */
.gl-text {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
  text-align: center;
  white-space: nowrap;
}

/* 初始加载提示（刷新页面时用，文案"正在请求进入服务器…"） */
.gl-text.initial {
  font-size: var(--fs-sm);
  letter-spacing: 0.5px;
}

@media (prefers-reduced-motion: reduce) {
  .gl-ring-outer, .gl-ring-inner, .gl-orbit { animation-duration: 2.4s; }
  .gl-core { animation: none; }
}

/* ============================================================================
   7. 全局 Toast 提示（顶栏内嵌优先，无顶栏时浮动居中）
   - 视觉复用 .topbar-user 胶囊样式（灰白底 + 1px 边框 + 圆形头像图标）
   - inline 模式：覆盖 .topbar-user 位置，淡出用户名后弹入
   - floating 模式：fixed 居中顶部胶囊，用于登录页/启动期顶栏未渲染场景
   ============================================================================ */
.topbar-actions { position: relative; }

.topbar-toast {
  --toast-accent: var(--brand, #f97316);
  position: absolute;
  right: 0;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 5px;            /* 左 5px 与 .topbar-user 头像缩进对齐 */
  background: var(--slate-100);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0;
  transform: translate(0, -50%) scale(1);
  transform-origin: right center;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
  max-width: calc(100vw - 32px);
  will-change: transform, opacity;
  backface-visibility: hidden;
  contain: layout paint;
}

/* floating 模式：fixed 居中顶部，z-index 提到 loading 之上 */
.topbar-toast.floating {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  right: auto;
  transform: translate(-50%, 0) scale(1);
  transform-origin: center center;
  z-index: 100004;
}

.topbar-toast.show {
  animation: topbar-toast-in 480ms cubic-bezier(0.16, 1.35, 0.3, 1) both;
}
.topbar-toast.floating.show {
  animation: topbar-toast-floating-in 480ms cubic-bezier(0.16, 1.35, 0.3, 1) both;
}
.topbar-toast.is-leaving {
  animation: topbar-toast-out 180ms cubic-bezier(0.4, 0, 0.7, 1) both;
}
.topbar-toast.floating.is-leaving {
  animation: topbar-toast-floating-out 180ms cubic-bezier(0.4, 0, 0.7, 1) both;
}

/* inline 模式 keyframes：右侧滑入 + 缩放（垂直居中 transform 兼顾） */
@keyframes topbar-toast-in {
  0%   { opacity: 0; transform: translate(10px, -50%) scale(0.66); }
  100% { opacity: 1; transform: translate(0, -50%) scale(1); }
}
@keyframes topbar-toast-out {
  0%   { opacity: 1; transform: translate(0, -50%) scale(1); }
  100% { opacity: 0; transform: translate(8px, -50%) scale(0.78); }
}
/* floating 模式 keyframes：顶部下落 + 居中缩放 */
@keyframes topbar-toast-floating-in {
  0%   { opacity: 0; transform: translate(-50%, -8px) scale(0.66); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes topbar-toast-floating-out {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -6px) scale(0.78); }
}

/* inline 模式下隐藏被覆盖的 .topbar-user */
.topbar-actions.showing-toast .topbar-user {
  opacity: 0;
  pointer-events: none;
}

.topbar-toast .toast-icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--toast-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-toast .toast-icon svg { width: 14px; height: 14px; }
.topbar-toast .toast-message {
  min-width: 0;
  max-width: min(220px, calc(100vw - 110px));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

/* 类型变体：仅切换图标颜色 */
.topbar-toast.toast-success { --toast-accent: var(--brand, #f97316); }
.topbar-toast.toast-error   { --toast-accent: var(--danger, #ef4444); }
.topbar-toast.toast-info    { --toast-accent: var(--brand, #f97316); }

@media (prefers-reduced-motion: reduce) {
  .topbar-toast.show {
    opacity: 1;
    transform: translate(0, -50%);
    animation: none;
  }
  .topbar-toast.floating.show {
    opacity: 1;
    transform: translate(-50%, 0);
    animation: none;
  }
  .topbar-toast.is-leaving {
    opacity: 0;
    transform: translate(0, -50%);
    animation: none;
  }
  .topbar-toast.floating.is-leaving {
    opacity: 0;
    transform: translate(-50%, 0);
    animation: none;
  }
}

/* ============================================================================
   8. 全局确认弹窗
   ============================================================================ */
.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-out);
}
.app-confirm-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.app-confirm-dialog {
  width: min(360px, 100%);
  padding: 24px 22px 18px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  background: #fff;
  text-align: center;
  transform: translateY(16px) scale(0.96);
  transition: transform var(--dur-3) var(--ease-spring);
}
.app-confirm-overlay.show .app-confirm-dialog {
  transform: translateY(0) scale(1);
}
.app-confirm-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border: 1px solid var(--brand-400);
  border-radius: var(--r-md);
  background: var(--brand-100);
  color: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-confirm-icon .iconfont {
  font-size: 24px;
  line-height: 1;
}
.app-confirm-title {
  margin-bottom: 7px;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 700;
}
.app-confirm-message {
  min-height: 42px;
  margin-bottom: 18px;
  color: var(--text-light);
  font-size: var(--fs-sm);
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}
.app-confirm-actions {
  display: flex;
  gap: 10px;
}
.app-confirm-btn {
  flex: 1;
  height: 44px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-2), border-color var(--dur-2), transform var(--dur-1);
}
.app-confirm-btn:active { transform: scale(0.97); }
.app-confirm-btn.cancel {
  border-color: var(--slate-200);
  background: var(--slate-100);
  color: var(--slate-600);
}
.app-confirm-btn.cancel:hover { background: var(--slate-200); }
.app-confirm-btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.app-confirm-btn.primary:hover {
  border-color: var(--brand-600);
  background: var(--brand-600);
}

/* ============================================================================
   9. 弹层（sheet-mask / action-sheet / form-sheet）
   ============================================================================ */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }

/* 弹层打开时锁定 body 滚动，避免移动端滚动穿透到背后的内容页 */
body.sheet-open {
  overflow: hidden;
}

/* 遮罩层加载指示器（数据同步期间显示） */
.sheet-mask::after {
  content: '';
  width: 36px; height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: maskSpin 0.8s linear infinite;
  opacity: 0;
  transition: opacity var(--dur-2);
}
.sheet-mask.loading::after { opacity: 1; }
@keyframes maskSpin { to { transform: rotate(360deg); } }

/* 底部 sheet（移动端上滑入场） */
.action-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 20px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translateY(100%);
  transition: transform var(--dur-3) var(--ease-out);
  z-index: 9001;
  max-height: 90vh;
  overflow-y: auto;
  pointer-events: none;
}
.action-sheet.show { transform: translateY(0); pointer-events: auto; }

/* 桌面端：弹窗居中显示 */
@media (min-width: 768px) {
  .action-sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: 440px;
    max-width: calc(100vw - 40px);
    border-radius: var(--r-xl);
    padding: 28px;
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  }
  .action-sheet.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .sheet-handle { display: none; }
}

.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.sheet-title { font-size: var(--fs-md); font-weight: 600; text-align: center; margin-bottom: 6px; }
.sheet-sub { font-size: var(--fs-xs); color: var(--text-light); text-align: center; margin-bottom: 18px; }
.sheet-info {
  background: var(--slate-50);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: var(--fs-xs);
  color: var(--text-light);
  line-height: 1.6;
}
.sheet-info b { color: var(--text); }

/* 弹层按钮 */
.sheet-actions { display: flex; gap: 10px; }
.sheet-btn {
  flex: 1;
  height: 48px;
  border-radius: var(--r-md);
  border: none;
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--dur-2);
  font-family: inherit;
}
.sheet-btn:active { transform: scale(0.97); }
.sheet-btn.cancel { background: var(--slate-100); color: var(--slate-600); }
.sheet-btn.confirm {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--elev-brand);
}
.sheet-btn.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: var(--elev-danger);
}
.sheet-btn:disabled,
.sheet-btn.disabled-weak {
  background: var(--slate-200) !important;
  color: var(--slate-400) !important;
  box-shadow: none !important;
  cursor: not-allowed;
  opacity: 0.85;
  transform: none !important;
}

/* 表单弹窗 */
.form-sheet { max-height: 90vh; overflow-y: auto; }
.form-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.form-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.form-field label {
  font-size: var(--fs-xs);
  color: var(--text-light);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.form-field input, .form-field select {
  height: 46px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--slate-50);
  font-size: var(--fs-sm);
  color: var(--text);
  outline: none;
  transition: var(--dur-2);
  font-family: inherit;
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* 角色选择器 */
.role-picker { display: flex; gap: 8px; }
.role-opt {
  flex: 1;
  height: 44px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--slate-50);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--dur-2);
}
.role-opt:active { transform: scale(0.97); }
.role-opt.active {
  border-color: var(--brand);
  background: var(--brand-100);
  color: var(--brand);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.15);
}

/* ============================================================================
   9. 顶栏 app-header + content 滚动区
   ============================================================================ */
.app-header {
  flex: 0 0 auto;
  padding: 14px 18px 10px;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--elev-brand);
  position: relative;
  z-index: 5;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-brand .badge {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.22);
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.header-brand .badge svg { width: 20px; height: 20px; }
.header-brand h1 {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: var(--dur-2);
}
.header-user:active { transform: scale(0.95); }
.header-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #f472b6;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 700; color: #fff;
}
.header-user .erp-text { font-size: var(--fs-xs); font-weight: 600; }

/* 头部操作按钮 */
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.header-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: var(--dur-2);
}
.header-add-btn:active { transform: scale(0.95); }
.header-add-btn svg { width: 16px; height: 16px; }
.header-add-btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

/* 内容滚动区 */
.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 96px);
}
.content::-webkit-scrollbar { width: 0; }

/* 桌面端：头部白底 + 内容区限宽 */
@media (min-width: 768px) {
  .app-header {
    padding: 20px 32px 16px;
    background: #fff;
    color: var(--text);
    box-shadow: none;
    border-bottom: 1px solid var(--border);
  }
  .header-brand .badge {
    background: var(--brand);
  }
  .header-brand .badge svg path,
  .header-brand .badge svg rect { stroke: #fff; }
  .header-brand h1 { font-size: var(--fs-xl); color: var(--text); }
  .header-user {
    background: var(--slate-100);
    color: var(--text);
    padding: 6px 14px 6px 6px;
  }
  .header-user .avatar {
    background: var(--brand);
  }
  .header-user .erp-text { color: var(--text); font-weight: 600; }
  .header-add-btn {
    background: var(--brand);
    border-color: transparent;
    box-shadow: var(--elev-brand);
    color: #fff;
  }
  .header-add-btn.ghost {
    background: rgba(15, 23, 42, 0.05);
    color: var(--brand-600);
    border-color: var(--border);
    box-shadow: none;
  }
  .content {
    padding: 24px 32px 32px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
  }
  .content::-webkit-scrollbar { width: 6px; }
  .content::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }
}

/* ============================================================================
   10. 移动端 FAB 圆形菜单（管理员）
   ============================================================================ */
.fab-wrap {
  position: fixed;
  right: 20px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  z-index: 60;
}
.fab-btn {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--brand);
  border: none;
  box-shadow: var(--elev-brand), 0 0 0 0 rgba(249, 115, 22, 0.35);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  z-index: 2;
  transition: transform var(--dur-4) var(--ease-spring), box-shadow var(--dur-3), background var(--dur-3);
  animation: fabPulse 2.4s var(--ease-in-out) infinite;
}
@keyframes fabPulse {
  0%, 100% { box-shadow: var(--elev-brand), 0 0 0 0 rgba(249, 115, 22, 0.35); }
  50% { box-shadow: var(--elev-brand), 0 0 0 12px rgba(249, 115, 22, 0); }
}
.fab-btn:hover { transform: scale(1.06); }
.fab-btn:active { transform: scale(0.94); }
.fab-btn svg, .fab-btn i {
  position: absolute;
  transition: transform var(--dur-3), opacity var(--dur-2);
}
.fab-btn svg { width: 26px; height: 26px; }
.fab-btn i { font-size: 26px; line-height: 1; }
.fab-ico-close { opacity: 0; transform: rotate(-90deg); }
.fab-wrap.open .fab-btn {
  background: var(--danger);
  box-shadow: var(--elev-danger);
  animation: none;
  transform: rotate(135deg);
}
.fab-wrap.open .fab-ico-plus { opacity: 0; transform: rotate(90deg); }
.fab-wrap.open .fab-ico-close { opacity: 1; transform: rotate(0deg); }

/* FAB 背景遮罩（挂在 body 顶层，与 fab-wrap 同级；避免父级 transform 污染 containing block，从而出现长方形小遮罩） */
.fab-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-3);
  z-index: 200;
}
.fab-mask.is-open { opacity: 1; pointer-events: auto; }
/* 旧后代选择器保留回退（避免版本号不一致期间出现瞬间全透明） */
.fab-wrap.open ~ .fab-mask { opacity: 1; pointer-events: auto; }

/* 散开菜单 */
.fab-menu {
  position: absolute;
  right: 7px;
  bottom: 62px;
  z-index: 1;
}
.fab-menu-item {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(0, 0) scale(0.5);
  transition: transform var(--dur-4) var(--ease-spring), opacity var(--dur-3);
}
.fab-wrap.open .fab-menu-item {
  opacity: 1;
  pointer-events: auto;
  transform: translate(calc(var(--i) * -2px), calc(var(--i) * -68px)) scale(1);
  transition-delay: calc(var(--i) * 0.05s);
}
.fab-mi-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--elev-2);
  border: 3px solid #fff;
  flex-shrink: 0;
  transition: transform var(--dur-2);
}
.fab-mi-icon svg { width: 22px; height: 22px; }
.fab-menu-item:active .fab-mi-icon { transform: scale(0.88); }
.fab-mi-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #fff;
  background: rgba(15, 23, 42, 0.88);
  padding: 5px 12px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: var(--elev-1);
  order: -1;
}

/* 桌面端隐藏 FAB（用侧边栏） */
@media (min-width: 768px) {
  .fab-wrap { display: none; }
}

/* ============================================================================
   11. 图片大图查看器 + 加载点动画
   ============================================================================ */
.img-viewer {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0, 0, 0, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) ease;
  cursor: zoom-out;
}
.img-viewer.show { opacity: 1; pointer-events: auto; }
.img-viewer img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.85);
  transition: transform var(--dur-3) var(--ease-spring);
}
.img-viewer.show img { transform: scale(1); }

/* 加载点动画（仅用于行内细节，全局 loading 不用） */
.dots span {
  display: inline-block;
  width: 6px; height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: currentColor;
  animation: dotBounce 1.2s infinite;
}
