﻿:root {
  --text-color: #1A1B1C;
  --text-secondary: #6B7280;
  --background: #F4F3EE;
  --card: #FFFFFF;
  --border: #E4E3DD;
  --accent: #5B6CBF;
  --accent-soft: #EEF0FB;
  --success: #52C41A;
  --warning: #FAAD14;
  --danger: #EA6668;
  --radius: 12px;
  /* 新增：用于暗色主题切换的衍生色 */
  --input-bg: #FFFFFF;
  --input-text: #1A1B1C;
  --btn-gray-bg: #E4E3DD;
  --btn-gray-text: #333333;
  --th-bg: rgba(0,0,0,.015);
  --row-hover: rgba(91,108,191,.03);
  --code-bg: rgba(0,0,0,.05);
  --sidebar-bg: #1F2430;
  --sidebar-text: #C7CBD4;
  --shadow: 0 8px 30px rgba(0,0,0,.12);
}

/* ========== 暗色主题 ========== */
[data-theme="dark"] {
  --text-color: #E7E9EE;
  --text-secondary: #9AA0A6;
  --background: #14161C;
  --card: #1E2129;
  --border: #2C303B;
  --accent: #7A8BDE;
  --accent-soft: rgba(122,139,222,.16);
  --success: #52C41A;
  --warning: #FAAD14;
  --danger: #F0716F;
  --input-bg: #171A21;
  --input-text: #E7E9EE;
  --btn-gray-bg: #2C303B;
  --btn-gray-text: #D6D8DE;
  --th-bg: rgba(255,255,255,.03);
  --row-hover: rgba(122,139,222,.08);
  --code-bg: rgba(255,255,255,.08);
  --sidebar-bg: #171A21;
  --sidebar-text: #AEB3BD;
  --shadow: 0 8px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ========== 图片懒加载优化 ========== */
/* 内容区域图片默认懒加载，减少首屏资源加载量 */
.main img {
  loading: lazy;
  max-width: 100%;
  height: auto;
}
/* 关键首屏图片可手动添加 fetchpriority-high 类提升优先级 */
.fetchpriority-high {
  fetchpriority: high;
  loading: eager;
}

body {
  font-family: 'Roboto', 'PingFang SC', 'Segoe UI', Arial, sans-serif;
  background: var(--background);
  color: var(--text-color);
  font-size: 14px;
  line-height: 1.6;
  transition: background .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .8; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text); flex-shrink: 0;
  display: flex; flex-direction: column; padding: 16px 0;
  position: sticky; top: 0; height: 100vh;
  transition: background .2s ease;
}
.sidebar .brand { padding: 0 20px 16px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.sidebar nav a {
  display: block; padding: 10px 20px; color: var(--sidebar-text); font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; border-left-color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.sidebar nav .menu-label { margin: 14px 20px 6px; font-size: 11px; color: #7d8491; letter-spacing: .5px; text-transform: uppercase; }
.sidebar nav .menu-label:first-child { margin-top: 2px; }
/* 菜单项较多时，让 nav 在固定 100vh 的侧边栏内独立滚动，避免底部菜单/用户框被截断且无法下滑 */
.sidebar nav { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.sidebar .spacer { flex: 0 0 8px; }
.sidebar .user-box { padding: 12px 20px; font-size: 12px; color: #9AA0A6; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }

.main { flex: 1; padding: 24px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.topbar h1 { font-size: 20px; font-weight: 600; }
.page-desc { margin: -12px 0 16px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; max-width: 860px; }
.page-desc code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ========== 顶部全局工具条（主题切换 / 文档抽屉 / 全局搜索） ========== */
.globalbar {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  margin-bottom: 14px;
}
.global-search { position: relative; flex: 0 1 260px; }
.global-search input {
  width: 100%; padding: 7px 34px 7px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--input-bg); color: var(--input-text); outline: none;
}
.global-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.global-search .search-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-size: 13px; pointer-events: none; }
.search-suggest {
  position: absolute; right: 0; top: 42px; width: 340px; max-height: 380px; overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); z-index: 50; display: none; padding: 6px;
}
.search-suggest.show { display: block; }
.search-suggest .s-item { display: block; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text-color); }
.search-suggest .s-item:hover { background: var(--accent-soft); }
.search-suggest .s-item .s-kind { color: var(--text-secondary); font-size: 11px; margin-left: 6px; }
.search-suggest .s-empty { padding: 10px; color: var(--text-secondary); font-size: 12px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text-color); font-size: 13px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ========== 文档抽屉 ========== */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; display: none; }
.drawer-mask.show { display: block; }
.doc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw; z-index: 100;
  background: var(--card); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.doc-drawer.show { transform: translateX(0); }
.doc-drawer .dd-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.doc-drawer .dd-head h3 { font-size: 15px; }
.doc-drawer .dd-body { flex: 1; overflow: auto; padding: 14px 18px; }
.dd-section { margin-bottom: 18px; }
.dd-section h4 { font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.dd-section a { display: block; padding: 5px 0; font-size: 13px; color: var(--text-color); }
.dd-section a:hover { color: var(--accent); }
.dd-code { background: var(--code-bg); border-radius: 8px; padding: 10px 12px; font-family: Consolas, monospace; font-size: 12px; white-space: pre; overflow-x: auto; color: var(--text-color); }
.dd-lang-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.dd-lang-tabs button { padding: 3px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--card); color: var(--text-secondary); font-size: 12px; cursor: pointer; }
.dd-lang-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 卡片与网格 */
.grid { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; flex: 1 1 160px; min-width: 140px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 2px 12px rgba(0,0,0,.04);
}
.card .label { font-size: 12px; color: var(--text-secondary); }
.card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.card .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 2px 12px rgba(0,0,0,.04);
}
.panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; background: var(--th-bg); }
tr:hover td { background: var(--row-hover); }

/* 徽标 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.green { background: rgba(82,196,26,.12); color: #389E0D; }
.badge.blue { background: rgba(91,108,191,.12); color: #3A4EAD; }
.badge.gray { background: rgba(0,0,0,.06); color: #6B7280; }
.badge.red { background: rgba(234,102,104,.12); color: #C0392B; }
.badge.orange { background: rgba(250,173,20,.15); color: #AD6800; }
[data-theme="dark"] .badge.green { color: #7FD85F; }
[data-theme="dark"] .badge.blue { color: #9DB1F0; }
[data-theme="dark"] .badge.gray { background: rgba(255,255,255,.08); color: #B7BCC4; }
[data-theme="dark"] .badge.red { color: #F79A97; }
[data-theme="dark"] .badge.orange { color: #F5C36B; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--input-bg); color: var(--input-text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 90px; font-family: monospace; }

.btn {
  display: inline-block; padding: 8px 18px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; background: var(--accent); color: #fff;
}
.btn:hover { opacity: .9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-gray { background: var(--btn-gray-bg); color: var(--btn-gray-text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-current { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger-outline { background: transparent; color: #C0392B; border: 1px solid rgba(192,57,43,.45); }
.navbtn { white-space: nowrap; flex: 0 0 auto; }

/* 行内操作按钮间距：避免编辑/删除/封禁等按钮紧贴误点 */
td .btn { margin-right: 6px; }
td .btn:last-child { margin-right: 0; }

/* 行操作下拉（更多…）：收纳次要操作，避免操作列按钮过多换行拥挤 */
.row-actions { position: relative; display: inline-flex; align-items: center; white-space: nowrap; }
.row-actions .more-menu {
  display: none; position: absolute; top: 100%; right: 0; z-index: 50; min-width: 150px;
  background: var(--card, #fff); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; margin-top: 4px;
}
.row-actions .more-menu.show { display: block; position: fixed; }
.row-actions .more-menu a,
.row-actions .more-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; border-radius: 6px;
  font-size: 13px; background: transparent; color: var(--text, #1F2937); cursor: pointer; text-decoration: none;
}
.row-actions .more-menu a:hover,
.row-actions .more-menu button:hover { background: var(--row-hover, #F3F4F6); }
.row-actions .more-menu .danger { color: #C0392B; }
.row-actions .more-menu .divider { height: 1px; background: var(--border); margin: 4px 0; }
[data-theme="dark"] .row-actions .more-menu { background: #1E2430; border-color: #2C3444; }
[data-theme="dark"] .row-actions .more-menu a,
[data-theme="dark"] .row-actions .more-menu button { color: #E5E7EB; }
[data-theme="dark"] .row-actions .more-menu a:hover,
[data-theme="dark"] .row-actions .more-menu button:hover { background: #2A3342; }

/* 提示 */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash.success { background: rgba(82,196,26,.1); color: #389E0D; }
.flash.error { background: rgba(234,102,104,.1); color: #C0392B; }
[data-theme="dark"] .flash.success { color: #7FD85F; }
[data-theme="dark"] .flash.error { color: #F79A97; }

/* 分页 */
.pagination { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); font-size: 13px; background: var(--card); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 筛选栏 */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 130px; }

/* 登录页 */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 360px; max-width: 92%; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box .sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }

/* 工具行 */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.mono { font-family: Consolas, monospace; font-size: 12px; }

/* 数据报表：指标卡网格 */
.stats-grid { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.stat-card {
  flex: 1 1 200px; min-width: 170px; position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.stat-card .num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-card .label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.stat-card.green::before { background: var(--success); }
.stat-card.green .num { color: #389E0D; }
.stat-card.red::before { background: var(--danger); }
.stat-card.red .num { color: #C0392B; }

/* 双栏面板网格 */
.grid-2 { display: flex; flex-wrap: wrap; gap: 20px; }
.grid-2 .panel { flex: 1 1 380px; min-width: 0; }

/* 图表容器 */
.chart-box { width: 100%; height: 280px; }
.chart-fallback { display: none; font-family: inherit; font-size: 13px; color: var(--text-color); line-height: 1.6; }
.echarts-fallback .chart-box { display: none; }
.echarts-fallback .chart-fallback { display: block; padding: 8px 2px; }
.chart-fallback table { width: auto; font-size: 13px; color: var(--text-color); }
.chart-fallback td { padding: 5px 18px 5px 0; border: none; white-space: nowrap; }
.chart-fallback td:last-child { color: var(--text-secondary); }
.chart-fallback b { font-weight: 600; color: var(--accent, #4e6ef2); font-family: inherit; }

/* ========== 批量操作条 ========== */
.batch-bar {
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 12px; font-size: 13px;
}
.batch-bar.show { display: flex; }
.batch-bar input[type=number] { width: 90px; }
.batch-bar input[type=text] { width: 130px; }

/* 移动端 */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px; }
  .sidebar .brand { border: none; padding: 4px 12px; margin: 0; font-size: 14px; }
  .sidebar nav { display: flex; flex-wrap: wrap; flex: 0 0 auto; overflow: visible; }
  .sidebar .spacer { display: none; }
  .sidebar nav a { padding: 6px 10px; border: none; border-radius: 6px; font-size: 13px; }
  .sidebar .user-box { padding: 4px 12px; border: none; }
  .main { padding: 16px; }
  .card { flex: 1 1 100%; }
  .stat-card { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .grid-2 .panel { flex: 1 1 100%; }
  .globalbar { flex-wrap: wrap; }
  .global-search { flex: 1 1 100%; }
  .doc-drawer { width: 100%; max-width: 100%; }
  .search-suggest { width: 100%; }
}

/* ================================================================
   UI/UX 升级 v2.0 新增样式
   - 侧边栏折叠 / 分组折叠
   - 移动端抽屉导航
   - 自定义 Modal
   - 面包屑导航
   - 空状态
   - 加载状态
   ================================================================ */

/* ========== 侧边栏可折叠 ========== */
.sidebar {
  transition: width .25s ease, background .2s ease;
}
.sidebar.collapsed {
  width: 64px;
}
.sidebar.collapsed .brand {
  padding: 0 12px 12px;
  font-size: 0;
  text-align: center;
}
.sidebar.collapsed .brand::before {
  content: "🔐";
  font-size: 20px;
}
.sidebar.collapsed nav a {
  padding: 12px 0;
  text-align: center;
  font-size: 0;
  border-left: none;
  border-radius: 0;
}
.sidebar.collapsed nav a::before {
  font-size: 18px;
}
.sidebar.collapsed nav .menu-label {
  display: none;
}
.sidebar.collapsed .user-box {
  padding: 8px;
  text-align: center;
  font-size: 0;
}
.sidebar.collapsed .user-box a {
  display: block;
  font-size: 14px;
  margin: 0;
}
.sidebar.collapsed .user-box::before {
  content: "👤";
  font-size: 18px;
  display: block;
  margin-bottom: 4px;
}

/* 侧边栏折叠按钮 */
.sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 20px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: transform .25s ease;
}
.sidebar.collapsed .sidebar-toggle {
  transform: rotate(180deg);
}
.sidebar-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ========== 菜单分组折叠 ========== */
.menu-group {
  margin-bottom: 2px;
}
.menu-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  font-size: 11px;
  color: #7d8491;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  margin-top: 10px;
}
.menu-group-header:hover {
  color: #fff;
}
.menu-group-header .group-arrow {
  font-size: 10px;
  transition: transform .2s ease;
  opacity: .7;
}
.menu-group.collapsed .group-arrow {
  transform: rotate(-90deg);
}
.menu-group.collapsed .menu-group-items {
  display: none;
}
.menu-group-items {
  overflow: hidden;
}

/* 收起状态下隐藏分组标题，直接显示图标 */
.sidebar.collapsed .menu-group-header {
  display: none;
}
.sidebar.collapsed .menu-group-items {
  display: block !important;
}

/* ========== 移动端抽屉导航 ========== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-color);
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
}
.mobile-sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 190;
  opacity: 0;
  transition: opacity .25s ease;
}
.mobile-sidebar-mask.show {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    max-width: 80vw;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 16px 0;
    height: 100vh;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .sidebar .brand {
    display: block;
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: 0 20px 16px;
    margin-bottom: 12px;
    font-size: 16px;
  }
  .sidebar nav {
    display: block;
    flex: 1;
    overflow-y: auto;
  }
  .sidebar nav a {
    display: block;
    padding: 10px 20px;
    border-radius: 0;
    font-size: 14px;
    border-left: 3px solid transparent;
  }
  .sidebar nav a.active {
    background: var(--accent);
    color: #fff;
    border-left-color: #fff;
    font-weight: 600;
  }
  .sidebar .spacer {
    display: block;
  }
  .sidebar .user-box {
    display: block;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 12px;
  }
  .sidebar .sidebar-toggle {
    display: none;
  }
  .main {
    padding: 60px 16px 16px;
  }
  /* 面包屑移动端 */
  .breadcrumb {
    font-size: 12px;
    flex-wrap: wrap;
  }
}

/* ========== 面包屑导航 ========== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-secondary);
  transition: color .2s ease;
}
.breadcrumb a:hover {
  color: var(--accent);
}
.breadcrumb .sep {
  color: var(--border);
  font-size: 11px;
}
.breadcrumb .current {
  color: var(--text-color);
  font-weight: 500;
}

/* ========== 自定义 Modal ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease;
}
.modal-mask.show {
  display: flex;
  opacity: 1;
}
.modal {
  background: var(--card);
  border-radius: 14px;
  min-width: 320px;
  max-width: 92vw;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  transform: scale(.95) translateY(10px);
  transition: transform .2s ease;
  display: flex;
  flex-direction: column;
}
.modal-mask.show .modal {
  transform: scale(1) translateY(0);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.7;
}
.modal-body .modal-icon {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.modal-body .modal-icon .icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.modal-body .modal-icon.confirm .icon-circle {
  background: rgba(234,102,104,.12);
}
.modal-body .modal-icon.info .icon-circle {
  background: var(--accent-soft);
}
.modal-body .modal-icon.success .icon-circle {
  background: rgba(82,196,26,.12);
}
.modal-body .modal-icon.warning .icon-circle {
  background: rgba(250,173,20,.15);
}
.modal-body .modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.modal-body .modal-desc {
  color: var(--text-secondary);
  font-size: 13px;
}
.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--background);
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: .5;
}
.empty-state .empty-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 6px;
}
.empty-state .empty-desc {
  font-size: 13px;
  margin-bottom: 16px;
}

/* ========== 加载状态 ========== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.btn.loading {
  opacity: .7;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 8px;
  vertical-align: -2px;
}

/* ========== 按钮状态补充 ========== */
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn:active {
  transform: translateY(1px);
}

/* ========== 顶栏左侧按钮（移动端汉堡 / 折叠按钮位置调整） ========== */
.globalbar {
  justify-content: space-between;
}
.globalbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.globalbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ========== 暗色主题补充 ========== */
[data-theme="dark"] .modal {
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
[data-theme="dark"] .modal-foot {
  background: rgba(0,0,0,.2);
}
[data-theme="dark"] .mobile-menu-btn {
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
[data-theme="dark"] .empty-state .empty-icon {
  opacity: .4;
}

/* ========== 微交互动效 ========== */
.btn, .icon-btn, .sidebar nav a, .badge, .card, .stat-card {
  transition: all .2s ease;
}
.card:hover, .stat-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
[data-theme="dark"] .card:hover,
[data-theme="dark"] .stat-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.2);
}

/* ========== 菜单项图标 ========== */
.sidebar nav a .menu-icon {
  display: inline-block;
  width: 18px;
  margin-right: 8px;
  text-align: center;
}
.sidebar.collapsed nav a .menu-icon {
  margin-right: 0;
}
.sidebar.collapsed nav a .menu-text {
  display: none;
}

/* ========== 列表页顶部标题区 ========== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 600;
}
.page-header .page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.page-header .header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ================================================================
   运营看板 v2.0 新增样式
   - 时间范围筛选器
   - 指标卡分组
   - 趋势标签（同比/环比）
   - 暗色主题适配
   ================================================================ */

/* ---------- 时间范围筛选器 ---------- */
.range-filter-panel {
  padding: 14px 18px;
  margin-bottom: 20px;
}
.range-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.range-filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
  flex-shrink: 0;
}
.range-filter-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.range-btn {
  min-width: 60px;
  text-align: center;
  transition: all .2s ease;
}
.range-btn:hover {
  opacity: .85;
}
.range-custom-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.range-custom-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}
.range-date-input {
  width: auto;
  min-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
}

/* ---------- 指标分组 ---------- */
.metrics-group {
  margin-bottom: 24px;
}
.metrics-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-left: 4px;
}
.metrics-group-title .group-icon {
  font-size: 18px;
}
.metrics-group-title > span:nth-child(2) {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
}
.metrics-group-title .group-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 4px;
}
.metrics-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- 指标卡 ---------- */
.metric-card {
  flex: 1 1 200px;
  min-width: 170px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 2px 12px rgba(0,0,0,.04);
  position: relative;
  overflow: hidden;
  transition: all .2s ease;
}
.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: .6;
}
.metric-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
.metric-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
}
.metric-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 8px;
}
.metric-trends {
  display: flex;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 2px;
}
.trend-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 2px;
}

/* ---------- 趋势标签 ---------- */
.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.trend-badge.trend-up {
  background: rgba(82, 196, 26, .12);
  color: #389E0D;
}
.trend-badge.trend-down {
  background: rgba(234, 102, 104, .12);
  color: #C0392B;
}
.trend-badge.trend-flat {
  background: rgba(107, 114, 128, .12);
  color: var(--text-secondary);
}

/* ---------- 暗色主题适配 ---------- */
[data-theme="dark"] .metric-card {
  box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 2px 12px rgba(0,0,0,.15);
}
[data-theme="dark"] .metric-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
}
[data-theme="dark"] .trend-badge.trend-up {
  color: #7FD85F;
  background: rgba(82, 196, 26, .18);
}
[data-theme="dark"] .trend-badge.trend-down {
  color: #F79A97;
  background: rgba(234, 102, 104, .18);
}
[data-theme="dark"] .trend-badge.trend-flat {
  background: rgba(255, 255, 255, .08);
  color: #B7BCC4;
}
[data-theme="dark"] .range-custom-row {
  border-top-color: var(--border);
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
  .metric-card {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: 12px 14px;
  }
  .metric-value {
    font-size: 22px;
  }
  .range-filter-panel {
    padding: 12px 14px;
  }
  .range-filter-label {
    width: 100%;
    margin-bottom: 4px;
  }
  .metrics-group-title {
    font-size: 14px;
  }
  .range-date-input {
    min-width: 120px;
    font-size: 12px;
  }
}

/* ================================================================
   UI/UX v2.1 新增样式
   - 主题下拉菜单（亮色/暗色/跟随系统）
   - 全局空状态组件（4 种类型）
   ================================================================ */

/* ---------- 主题下拉菜单 ---------- */
.theme-dropdown {
  position: relative;
}
.theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 100;
  display: none;
}
.theme-menu.show {
  display: block;
}
.theme-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-color);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.theme-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.theme-item.active::after {
  content: "✓";
  margin-left: auto;
  font-size: 12px;
}

/* ---------- 全局空状态组件 ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.empty-state .empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: .5;
  line-height: 1;
}
.empty-state .empty-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 8px;
}
.empty-state .empty-desc {
  font-size: 13px;
  margin-bottom: 20px;
  max-width: 360px;
  line-height: 1.6;
}
.empty-state .empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 空状态类型变体 */
.empty-state.empty-default .empty-icon { opacity: .4; }

.empty-state.empty-search .empty-icon { opacity: .5; }
.empty-state.empty-search .empty-title { color: var(--text-color); }

.empty-state.empty-permission .empty-icon { opacity: .6; }
.empty-state.empty-permission .empty-title { color: var(--warning); }

.empty-state.empty-error .empty-icon { opacity: .6; }
.empty-state.empty-error .empty-title { color: var(--danger); }

/* 暗色主题空状态适配 */
[data-theme="dark"] .empty-state .empty-icon {
  opacity: .35;
}
[data-theme="dark"] .empty-state.empty-permission .empty-icon {
  opacity: .5;
}
[data-theme="dark"] .empty-state.empty-error .empty-icon {
  opacity: .5;
}

/* 表格内空状态 */
table .empty-state {
  padding: 40px 20px;
}
table .empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
table .empty-state .empty-title {
  font-size: 14px;
  margin-bottom: 6px;
}
table .empty-state .empty-desc {
  font-size: 12px;
  margin-bottom: 14px;
}

/* ================================================================
   批量操作 UI 组件
   - 批量操作栏（表格下方）
   - 全选复选框样式
   - 选中计数提示
   - 批量操作按钮组
   ================================================================ */

/* ---------- 批量操作栏 ---------- */
.batch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(91, 108, 191, .2);
  border-radius: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  transition: all .2s ease;
}

.batch-bar:empty {
  display: none;
}

.batch-bar .batch-count {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.batch-bar .batch-count b {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  margin: 0 2px;
}

.batch-bar .batch-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.batch-bar .batch-actions select {
  width: auto;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 13px;
  height: 32px;
}

.batch-bar .batch-actions input[type="number"],
.batch-bar .batch-actions input[type="text"] {
  width: auto;
  min-width: 100px;
  padding: 6px 10px;
  font-size: 13px;
  height: 32px;
}

.batch-bar .batch-actions .btn {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  line-height: 30px;
}

.batch-bar .batch-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* 暗色主题批量操作栏 */
[data-theme="dark"] .batch-bar {
  background: rgba(122, 139, 222, .12);
  border-color: rgba(122, 139, 222, .3);
}

[data-theme="dark"] .batch-bar .batch-count b {
  color: var(--accent);
}

/* ---------- 复选框样式 ---------- */
table input[type="checkbox"],
.batch-bar input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

table th input[type="checkbox"] {
  vertical-align: middle;
}

/* 选中行高亮 */
table tr.selected td {
  background: var(--accent-soft);
}

[data-theme="dark"] table tr.selected td {
  background: rgba(122, 139, 222, .08);
}

/* ---------- 批量导出按钮 ---------- */
.btn-export {
  background: #52C41A;
  color: #fff;
  border-color: #52C41A;
}

.btn-export:hover {
  background: #49B017;
  border-color: #49B017;
  opacity: 1;
}

.btn-export.btn-gray {
  background: var(--btn-gray-bg);
  color: var(--btn-gray-text);
  border-color: transparent;
}

.btn-export.btn-gray:hover {
  background: #52C41A;
  color: #fff;
  border-color: #52C41A;
}

/* ---------- 全选提示 ---------- */
.select-all-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.select-all-hint a {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
  .batch-bar {
    padding: 10px 12px;
    gap: 8px;
  }

  .batch-bar .batch-count {
    width: 100%;
    font-size: 12px;
  }

  .batch-bar .batch-actions {
    width: 100%;
  }

  .batch-bar .batch-actions select,
  .batch-bar .batch-actions input[type="number"],
  .batch-bar .batch-actions input[type="text"] {
    flex: 1;
    min-width: 80px;
  }
}
