/* ============================================================
   AI 发饰工坊 ERP V6.0 - AI风·智能风·年轻化
   设计系统 CSS
   ============================================================ */

/* ==================== 设计令牌 ==================== */
:root {
  /* 品牌渐变色 - 紫蓝青渐变（AI感） */
  --primary-start: #7C3AED;
  --primary-mid: #3B82F6;
  --primary-end: #06B6D4;
  --brand-gradient: linear-gradient(135deg, #7C3AED 0%, #3B82F6 50%, #06B6D4 100%);
  --brand-gradient-soft: linear-gradient(135deg, #EDE9FE 0%, #DBEAFE 50%, #CFFAFE 100%);

  /* 功能色 - 更明亮年轻 */
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --status-muted: #94A3B8;   /* 终态/完成态灰（石板灰，冷调配 v6 主色） */

  /* 年轻化中性色 */
  --bg-app: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F172A;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-inverse: #FFFFFF;
  --border: #E2E8F0;

  /* 圆角 - 更圆润 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* 阴影 - 更自然 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 20px rgba(124,58,237,0.15);

  /* 过渡 */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-fast: 0.2s var(--ease-smooth);
  --transition-bounce: 0.35s var(--ease-spring);

  /* 字体 */
  --font-sans: 'Inter', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* ==================== 兼容别名（历史页面仍引用旧名，统一映射到 v6 令牌） ==================== */
  --color-primary-100: #DBEAFE;
  --color-primary-500: #3B82F6;
  --color-primary-600: #2563EB;
  --color-primary-700: #1D4ED8;
  --color-secondary-100: #F1F5F9;
  --color-secondary-200: #E2E8F0;
  --color-secondary-500: #6B7280;
  --color-secondary-600: #475569;
  --color-secondary-700: #334155;
  --color-secondary-900: #0F172A;
  --color-error: #EF4444;
  --text-tertiary: #94A3B8;
  --bg-subtle: #F1F5F9;
  --hover-bg: #F1F5F9;
}

/* ==================== 全局基础 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ==================== 侧边栏（深色毛玻璃感） ==================== */
/* ==================== 侧边栏主体 ==================== */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: 120px; height: 100vh;
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: width var(--transition-fast);
  overflow: hidden;
}

.sidebar.collapsed { width: 64px; }

.sidebar-brand {
  padding: 16px 0;
  justify-content: center;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: 64px;
}

.sidebar-logo {
  width: 32px; height: 32px;
  background: var(--brand-gradient);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

.sidebar-brand-text {
  display: none;
  color: white;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-brand-text { opacity: 0; width: 0; overflow: hidden; }

.sidebar-menu {
  flex: 1;
  padding: 4px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px;
}

.menu-section-title {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.25);
  padding: 14px 14px 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .menu-section-title { display: none; }

.menu-item {
  display: flex; align-items: center; gap: 0;
  padding: 9px 10px 9px 8px;
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.menu-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.88);
}

.menu-item.active {
  background: rgba(124,58,237,0.15);
  color: #fff;
}

.menu-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--brand-gradient);
  border-radius: 0 3px 3px 0;
}

/* 容器标题：父项无独立权限但存在可见子项时，作为不可点击的分组标题（仅展开/收起） */
.menu-item.menu-head { cursor: default; }
.menu-item.menu-head:hover { background: transparent; color: rgba(255,255,255,0.55); }
.menu-item.menu-head .menu-caret { opacity: 0.55; }

/* 展开态彻底去掉图标（文字左顶，给二级菜单腾空间）；首字 span 默认隐藏，仅折叠态显示 */
.menu-icon {
  display: none;
}
.menu-initial {
  display: none;
  font-weight: 600;
  font-size: 15px;
}

.sidebar.collapsed .menu-text { display: none; }

/* ==================== 侧边栏二级导航（子菜单） ==================== */
.menu-group { display: flex; flex-direction: column; }
.menu-group.open > .menu-item { background: rgba(124,58,237,0.15); color: #fff; }

/* 折叠箭头：用纯 CSS border 制做 Material 风格小三角，避免字符旋转的视觉畸变 */
.menu-caret {
  margin-left: auto;
  display: inline-block;              /* 确保 border-arrow 尺寸生效 */
  width: 6px; height: 6px;
  border-right: 1.8px solid rgba(255,255,255,0.35);
  border-bottom: 1.8px solid rgba(255,255,255,0.35);
  transform: rotate(-45deg);          /* 收起：向右（›） */
  transition: transform var(--transition-fast);
  flex-shrink: 0;
  font-size: 0;                       /* 隐藏 shell.js 注入的 ▾ 字符 */
}
.menu-group.open .menu-caret { transform: rotate(45deg); }  /* 展开：向下（∨） */
.menu-group.open > .menu-item .menu-caret {
  border-color: rgba(255,255,255,0.7);  /* 展开态的 caret 更亮 */
}

/* 子菜单：120px 窄栏下几乎贴左、去掉竖线导引，避免长文本被 overflow 截断 */
.sub-menu {
  display: flex;
  flex-direction: column;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0 4px 0 4px;
  padding: 0;
  transition: max-height var(--transition-normal), opacity var(--transition-fast),
              margin var(--transition-fast), padding var(--transition-fast);
}
.menu-group.open .sub-menu {
  max-height: 400px;
  opacity: 1;
  margin: 1px 4px 4px 4px;
  padding: 0;
}

.sub-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 4px 6px 4px;
  border-radius: 6px;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.sub-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.sub-item.active { background: rgba(124,58,237,0.12); color: #fff; font-weight: 500; }
.sub-item::before {
  content: ''; flex-shrink: 0;
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
}
.sub-item:hover::before { background: rgba(255,255,255,0.4); }
.sub-item.active::before { background: rgba(124,58,237,0.7); }

.sidebar.collapsed .sub-menu { display: none !important; }
.sidebar.collapsed .menu-caret { display: none; }

/* 折叠态紧凑化：图标/logo/用户区全部居中，隐藏文字与冗余按钮，消除窄条里的空旷感 */
.sidebar.collapsed .sidebar-brand { padding: 20px 0; justify-content: center; }
.sidebar.collapsed .menu-item { padding: 10px 0; justify-content: center; }
.sidebar.collapsed .menu-icon { display: none; }
.sidebar.collapsed .menu-text { display: none; }      /* 折叠态隐藏全文 */
.sidebar.collapsed .menu-initial { display: inline; }  /* 折叠态只显示首字（如 商 / 采） */
.sidebar.collapsed .menu-item.active::before { display: none; }
.sidebar.collapsed .sidebar-footer { padding: 8px 0; }
.sidebar.collapsed .sidebar-user-info { justify-content: center; gap: 0; margin-bottom: 4px; }
.sidebar.collapsed .sidebar-user-name,
.sidebar.collapsed .sidebar-user-pwd { display: none; }
.sidebar.collapsed .sidebar-user-logout { margin-left: 0; }

/* 侧边栏折叠按钮 */
.sidebar-toggle {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  transition: color var(--transition-fast);
}
.sidebar-toggle:hover { color: rgba(255,255,255,0.8); }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

/* 侧边栏用户信息 */
.sidebar-footer {
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 4px 0;
}
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-gradient); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.sidebar-user-name {
  color: rgba(255,255,255,0.85);
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-notif {
  margin-left: auto;
  background: none; border: none; font-size: 16px; cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: color 0.15s;
}
.sidebar-user-notif:hover { color: #fff; }

/* 退出登录按钮：与通知按钮同视觉语言（透明、hover 变白） */
.sidebar-user-logout {
  margin-left: 6px;
  padding: 2px;
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.sidebar-user-logout:hover { color: #fff; }

/* ==================== 顶部导航栏 ==================== */
.topbar {
  position: fixed;
  left: 120px; top: 0; right: 0;
  height: 56px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  transition: left var(--transition-fast);
}

.sidebar.collapsed ~ .topbar { left: 64px; }

.topbar-left {
  display: flex; align-items: center; gap: 16px;
}

.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex; align-items: center; gap: 8px;
}

/* 搜索框 - 圆润风格 */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 7px 16px;
  width: 240px;
  transition: all var(--transition-fast);
}
.search-box:focus-within {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
  background: white;
}
.search-box input {
  border: none; outline: none;
  background: transparent;
  font-size: 13px;
  flex: 1;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

/* 图标按钮 */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}
.icon-btn:hover { background: var(--bg-app); color: var(--text-primary); }

.icon-btn .badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* 用户头像 */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124,58,237,0.2);
}

/* ==================== 主内容区 ==================== */
.main-content {
  margin-left: 120px;
  padding: 24px;
  min-height: 100vh;
  transition: margin-left var(--transition-fast);
}
.sidebar.collapsed ~ .main-content { margin-left: 64px; }

/* ==================== MDI 多标签工作区 ==================== */
/* 宿主页：.main-content 被改造为多标签容器（保留 main-content 类，兼容旧页面脚本引用） */
.mdi-host { margin-left: 120px; min-height: 100vh; display: flex; flex-direction: column; padding: 0; transition: margin-left var(--transition-fast); }
body.sidebar-collapsed .mdi-host { margin-left: 64px; }

.mdi-tabbar {
  height: 40px; flex-shrink: 0; display: flex; align-items: flex-end; gap: 2px;
  margin-left: 120px;   /* 与 .mdi-host 对齐，避开固定侧边栏 */
  padding: 0 6px; background: var(--bg-app); border-bottom: 1px solid var(--border);
  overflow-x: auto; overflow-y: hidden;
}
body.sidebar-collapsed .mdi-tabbar { margin-left: 64px; }
.mdi-tabbar::-webkit-scrollbar { height: 0; }
.mdi-tab {
  display: flex; align-items: center; gap: 7px; height: 32px; max-width: 200px;
  padding: 0 6px 0 12px; background: var(--bg-app);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; color: var(--text-secondary); font-size: 13px;
  white-space: nowrap; cursor: pointer; flex-shrink: 0; position: relative; top: 1px;
  user-select: none; transition: background var(--transition-fast), color var(--transition-fast);
}
.mdi-tab:hover { color: var(--text-primary); }
.mdi-tab.active { background: var(--bg-card); color: var(--text-primary); font-weight: 600; box-shadow: inset 0 -2px 0 #7C3AED; }
.mdi-tab .dot { width: 6px; height: 6px; border-radius: 50%; background: #7C3AED; flex-shrink: 0; }
.mdi-tab .tname { overflow: hidden; text-overflow: ellipsis; }
.mdi-tab .x {
  width: 18px; height: 18px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 14px; line-height: 1; flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.mdi-tab .x:hover { background: rgba(239,68,68,.12); color: var(--danger); }
/* 末尾 + 按钮：按需复制当前激活标签，开第二个同导航实例 */
.mdi-tab-new {
  width: 30px; min-width: 30px; padding: 0; justify-content: center;
  font-size: 18px; line-height: 1; color: var(--text-secondary);
  border: 1px dashed var(--border); background: transparent;
}
.mdi-tab-new:hover { color: #fff; border-color: #7C3AED; background: rgba(124,58,237,.12); }
/* 右键菜单中“关闭当前”对锁定的工作台置灰、不可点 */
.mdi-ctx-item.disabled { color: #64748B; opacity: .5; cursor: not-allowed; }

.mdi-stage { flex: 1; position: relative; overflow: hidden; background: var(--bg-app); }
.mdi-panel { position: absolute; inset: 0; overflow: auto; padding: 24px; background: var(--bg-app); }
.mdi-panel.hidden, .mdi-iframe.hidden { display: none; }
.mdi-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg-card); }

.mdi-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-secondary); gap: 10px; text-align: center; }

/* 右键菜单 */
.mdi-ctx {
  position: fixed; z-index: 9999; min-width: 136px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 4px; font-size: 13px; color: var(--text-primary);
}
.mdi-ctx-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; transition: background var(--transition-fast); }
.mdi-ctx-item:hover { background: var(--bg-app); }
.mdi-ctx-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* 重复打开确认弹窗（自定义，非浏览器 confirm） */
.mdi-confirm-mask {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(15,12,28,0.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: mdiFade var(--transition-fast);
}
@keyframes mdiFade { from { opacity: 0; } to { opacity: 1; } }
.mdi-confirm {
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 20px; color: var(--text-primary);
  animation: mdiPop var(--transition-normal);
}
@keyframes mdiPop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.mdi-confirm-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.mdi-confirm-msg { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 18px; }
.mdi-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.mdi-btn-ghost, .mdi-btn-primary {
  height: 34px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border); transition: all var(--transition-fast);
}
.mdi-btn-ghost { background: var(--bg-app); color: var(--text-primary); }
.mdi-btn-ghost:hover { border-color: #7C3AED; color: #7C3AED; }
.mdi-btn-primary { background: #7C3AED; color: #fff; border-color: #7C3AED; }
.mdi-btn-primary:hover { background: #6D28D1; }

/* ==================== 嵌入模式（iframe 内，?embed=1） ==================== */
/* 防御：嵌入模式下彻底隐藏任何由 shell.js 注入的侧边栏。
   标记由 <head> 内联脚本 + shell.js 顶部双保险同步写入（html.embed / body.embed 都覆盖），
   即便反向代理缓存了旧版 shell.js，也绝不会出现双导航。 */
body.embed .sidebar, html.embed .sidebar,
body.embed #app-sidebar, html.embed #app-sidebar { display: none !important; }
body.embed .main-content { margin-left: 0 !important; }

/* 所有页面嵌入 MDI 后，隐藏冗余的「返回 / 标题 / 子标签 / 面包屑」导航，
   由侧边栏 + 顶部标签栏统一接管，顶部更干净。
   功能性按钮（同步店铺 / 新增 / 保存 / 提交生产等）保留，它们不是导航。 */
body.embed .subnav { display: none; }
body.embed .topbar {
  background: transparent; border-bottom: 1px solid var(--border);
}
body.embed .topbar .back,
body.embed .topbar h1 { display: none; }
body.embed .breadcrumb { display: none; }
body.embed .tb-back { display: none; }

/* ==================== 统一应用外壳（全局注入式侧边栏） ==================== */
/* 折叠态以 body.sidebar-collapsed 为主，兼容各页面头部 .topbar 与 .header */
body.sidebar-collapsed .sidebar { width: 64px; }
body.sidebar-collapsed .sidebar .sidebar-brand-text,
body.sidebar-collapsed .sidebar .menu-section-title,
body.sidebar-collapsed .sidebar .menu-text { display: none; }
body.sidebar-collapsed .sidebar .sidebar-user-name,
body.sidebar-collapsed .sidebar .sidebar-user-notif { display: none; }
/* 折叠态：头像与退出按钮垂直居中对齐，确保退出始终可点 */
body.sidebar-collapsed .sidebar .sidebar-user-info {
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
body.sidebar-collapsed .sidebar .sidebar-user-logout { display: inline-flex; margin-left: 0; }
body.sidebar-collapsed .sidebar .sidebar-toggle { transform: rotate(180deg); }
body.sidebar-collapsed .main-content { margin-left: 64px; }
body.sidebar-collapsed .topbar,
body.sidebar-collapsed .header { left: 64px; }

/* 兼容仍保留真实 .sidebar 直接兄弟选择器的旧页面 */
.sidebar.collapsed ~ .header { left: 64px; }

/* ==================== 统计卡片（AI风渐变） ==================== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all var(--transition-bounce);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.stat-card:hover::before { opacity: 1; }

.stat-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.stat-card-icon.blue   { background: #EFF6FF; color: #3B82F6; }
.stat-card-icon.green  { background: #F0FDF4; color: #10B981; }
.stat-card-icon.orange { background: #FFF7ED; color: #F59E0B; }
.stat-card-icon.purple { background: #F5F3FF; color: #7C3AED; }

.stat-card-trend {
  font-size: 12px;
  font-weight: 500;
  display: flex; align-items: center; gap: 3px;
}
.stat-card-trend.up   { color: #10B981; }
.stat-card-trend.down { color: #EF4444; }

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.stat-card-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==================== 模块卡片（年轻化渐变背景） ==================== */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.module-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0;
  background: var(--brand-gradient-soft);
  transition: height 0.3s var(--ease-smooth);
  z-index: 0;
}

.module-card:hover::after { height: 100%; }
.module-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: rgba(124,58,237,0.2);
}

.module-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-xl);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin-bottom: 14px;
  position: relative; z-index: 1;
  transition: transform var(--transition-bounce);
}

.module-card:hover .module-icon { transform: scale(1.1); }

.module-icon.purple { background: linear-gradient(135deg, #EDE9FE, #DDD6FE); }
.module-icon.blue   { background: linear-gradient(135deg, #DBEAFE, #BFDBFE); }
.module-icon.green  { background: linear-gradient(135deg, #DCFCE7, #BBF7D0); }
.module-icon.orange { background: linear-gradient(135deg, #FFEDD5, #FED7AA); }
.module-icon.cyan   { background: linear-gradient(135deg, #CFFAFE, #A5F3FC); }
.module-icon.pink   { background: linear-gradient(135deg, #FCE7F3, #FBCFE8); }

.module-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  position: relative; z-index: 1;
}

.module-desc {
  font-size: 12px;
  color: var(--text-secondary);
  position: relative; z-index: 1;
}

/* ==================== 快捷操作按钮 ==================== */
.quick-actions {
  display: flex; gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.quick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  font-weight: 500;
}
.quick-btn:hover {
  background: var(--brand-gradient-soft);
  border-color: rgba(124,58,237,0.2);
  color: var(--primary-start);
}
.quick-btn .btn-icon { font-size: 16px; }

/* ==================== 卡片通用 ==================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(124,58,237,0.25);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-app); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: white;
  border: 1px solid var(--danger);
  box-shadow: 0 2px 8px rgba(239,68,68,0.22);
}
.btn-danger:hover {
  background: #DC2626;
  border-color: #DC2626;
  box-shadow: 0 4px 16px rgba(239,68,68,0.32);
  transform: translateY(-1px);
}

/* ==================== 表单 ==================== */
.form-input {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
  width: 100%;
}
.form-input:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ==================== 通用查询栏（全站统一同款，套用到各列表页筛选区） ==================== */
.fb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.fb label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.fb input[type="text"],
.fb input[type="search"],
.fb input:not([type]),
.fb select,
.fb textarea {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  width: auto;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fb input[type="text"],
.fb input[type="search"],
.fb input:not([type]) {
  min-width: 140px;
  max-width: 280px;
}
.fb select { min-width: 110px; cursor: pointer; }
.fb input:focus,
.fb select:focus,
.fb textarea:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.fb .btn { padding: 7px 14px; font-size: 13px; }
.fb-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ==================== 登录页背景动画 ==================== */
.login-bg-ai {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 40%, #312E81 70%, #0F172A 100%);
  overflow: hidden;
}

/* 动态光点 */
.login-bg-ai::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
  top: -200px; right: -200px;
  animation: floatGlow 8s ease-in-out infinite;
}

.login-bg-ai::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(6,182,212,0.1) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  animation: floatGlow 10s ease-in-out infinite reverse;
}

@keyframes floatGlow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar .menu-text,
  .sidebar .sidebar-brand-text,
  .sidebar .menu-section-title { display: none; }
  .sidebar .sub-menu,
  .sidebar .menu-caret { display: none; }
  .sidebar .sidebar-user-name,
  .sidebar .sidebar-user-notif { display: none; }
  .sidebar .sidebar-user-info { justify-content: center; flex-direction: column; gap: 6px; }
  .sidebar .sidebar-user-logout { margin-left: 0; }
  .topbar { left: 64px; }
  .main-content { margin-left: 64px; }
  .stat-cards { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
}
