/**
 * 全局样式 - 现代设计系统 v2.0
 * 风格：大圆角 + 柔和阴影 + 渐变 + 微交互
 */
:root {
  /* 主色调 - 更现代的渐变蓝 */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-active: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-bg: #eff6ff;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --primary-gradient-hover: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);

  /* 功能色 */
  --success-color: #10b981;
  --success-light: #d1fae5;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);

  --warning-color: #f59e0b;
  --warning-light: #fef3c7;
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

  --error-color: #ef4444;
  --error-light: #fee2e2;
  --error-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

  /* 文字色阶 - 提升对比度 */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-disabled: #d1d5db;

  /* 边框 - 更淡 */
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;

  /* 背景 - 更清爽的渐变灰 */
  --bg-color: #f8fafc;
  --bg-white: #ffffff;
  --bg-gray: #f9fafb;
  --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);

  /* 阴影 - 更柔和、更有层次 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.06);

  /* 圆角 - 更大、更圆润 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* 间距 - 更宽松 */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Inter', sans-serif;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;

  /* 动画 - 更顺滑 */
  --transition-base: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background-color: var(--bg-color);
  line-height: 1.6;
}

/* 后台页面：让页面本身不滚，滚动落在 .content 内部，sidebar 永远铺满视口 */
html, body {
  height: 100%;
  overflow: hidden;
}

/* 全局细滚动条：平时隐藏，鼠标 hover 到滚动容器时显示（蓝色主题） */
/* Webkit（Chrome/Edge/Safari） */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 2px;
  transition: background 0.2s;
}
*:hover > ::-webkit-scrollbar-thumb,
*:hover::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}
::-webkit-scrollbar-corner {
  background: transparent;
}
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
*:hover {
  scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition-base);
}

a:hover {
  color: var(--primary-hover);
}

/* 按钮样式 - 现代渐变风格 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: var(--font-size-base);
  font-weight: 500;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: var(--primary-gradient-hover);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.btn-success {
  background: var(--success-gradient);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.btn-warning {
  background: var(--warning-gradient);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--error-gradient);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 4px 12px;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--font-size-lg);
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* 标签样式 - 现代胶囊风格 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid transparent;
  line-height: 1.2;
}

.tag-primary {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.tag-success {
  background-color: var(--success-light);
  color: var(--success-color);
}

.tag-warning {
  background-color: var(--warning-light);
  color: var(--warning-color);
}

.tag-error {
  background-color: var(--error-light);
  color: var(--error-color);
}

.tag-default {
  background-color: var(--bg-gray);
  color: var(--text-secondary);
}

/* 卡片样式 - 统一间距 */
.card {
  background-color: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  transition: var(--transition-base);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* 表格样式 - 清晰易读风格 */
.table-container {
  overflow: auto;
  max-height: calc(100vh - 280px);
  border-radius: var(--radius-md);
}

/* 冻结列 - 横向滚动时左侧列固定 */
.freeze-table th,
.freeze-table td {
  background-color: #ffffff;
}
.freeze-table thead th {
  background-color: #f0f4f8;
}
.freeze-table tbody tr:nth-child(even) td {
  background-color: #fafbfc;
}
.freeze-table tbody tr:hover td {
  background-color: var(--primary-bg);
}
.freeze-table th:nth-child(1),
.freeze-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 2px 0 0 0 var(--border-light);
}
.freeze-table th:nth-child(1) {
  z-index: 3;
}
.freeze-table.freeze-2 th:nth-child(2),
.freeze-table.freeze-2 td:nth-child(2) {
  position: sticky;
  left: var(--freeze-1, 110px);
  z-index: 2;
  box-shadow: 2px 0 0 0 var(--border-light);
}
.freeze-table.freeze-2 th:nth-child(2) {
  z-index: 3;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--font-size-base);
}

thead {
  background-color: #f0f4f8;
}

th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  background-color: #f0f4f8;
  z-index: 1;
}

th:first-child {
  border-top-left-radius: var(--radius-md);
}

th:last-child {
  border-top-right-radius: var(--radius-md);
}

td {
  padding: 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: var(--transition-fast);
  font-size: var(--font-size-base);
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
  max-width: 280px;
  overflow: hidden;
}

.cell-2line {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

td.cell-wrap {
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

tbody tr {
  transition: var(--transition-fast);
}

tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

tbody tr:hover {
  background-color: var(--primary-bg);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* 表单样式 - 现代风格 */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-white);
  color: var(--text-primary);
  transition: var(--transition-base);
  font-family: inherit;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--primary-color);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  background-color: var(--bg-white);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* 布局 - 现代风格 */
.layout {
  display: flex;
  height: 100vh;
  background: var(--bg-gradient);
  overflow: hidden;
}

/* 侧边栏 - 现代浅色风格 */
.sidebar {
  width: 210px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease;
  position: relative;
}

.sidebar.collapsed {
  width: 80px;
}

/* 折叠态：logo 名称隐藏、分组标题隐藏，菜单项改纵向布局显示"图标+小字" */
.sidebar.collapsed .sidebar-logo span {
  display: none;
}
.sidebar.collapsed .menu-group-title {
  display: none;
}
.sidebar.collapsed .menu-item {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 8px 4px;
  gap: 2px;
  text-align: center;
}
.sidebar.collapsed .menu-item-icon {
  margin-right: 0;
  font-size: 20px;
  line-height: 1;
}
.sidebar.collapsed .menu-item span:not(.menu-item-icon) {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70px;
  display: block;
}

/* 侧边栏右边界拖动条 */
.sidebar-resizer {
  position: absolute;
  right: 0;
  top: 0;
  width: 4px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 20;
  transition: background 0.15s;
}
.sidebar-resizer:hover,
.sidebar-resizer:active {
  background: var(--primary-color, #3b82f6);
  opacity: 0.4;
}

.sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 28px;
  width: 24px;
  height: 24px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  font-size: 14px;
  color: var(--text-secondary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.sidebar-logo {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: -0.02em;
}

.sidebar-menu {
  padding: var(--spacing-md) var(--spacing-sm);
  flex: 1;
  overflow-y: auto;
}

.menu-group {
  margin-bottom: var(--spacing-md);
}

.menu-group-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  padding: 12px 16px 6px;
  margin-bottom: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 9px 16px 9px 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-base);
  border-radius: var(--radius-md);
  margin-bottom: 2px;
  font-weight: 700;
  font-size: 15px;
}

/* 分组标题下的子菜单项：保持较小字号 */
.menu-group .menu-item {
  font-weight: 500;
  font-size: 13px;
}

.menu-item:hover {
  color: var(--primary-color);
  background-color: var(--primary-bg);
}

.menu-item.active {
  color: white;
  background: var(--primary-gradient);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.menu-item-icon {
  margin-right: var(--spacing-sm);
  font-size: var(--font-size-lg);
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 顶部导航 - 毛玻璃效果 */
.header {
  height: 64px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-xl);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition-base);
}

.header-user:hover {
  background-color: var(--bg-gray);
  color: var(--text-primary);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-size-sm);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* 内容区 */
.content {
  flex: 1;
  padding: var(--spacing-xl);
  overflow-y: auto;
}

.page-header {
  margin-bottom: var(--spacing-lg);
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.page-desc {
  color: var(--text-tertiary);
  font-size: var(--font-size-base);
}

/* 筛选栏 - 统一间距 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.filter-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.filter-item label {
  display: none;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.filter-item select,
.filter-item input {
  padding: 8px 12px;
  font-size: var(--font-size-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-white);
  color: var(--text-primary);
  transition: var(--transition-base);
}

.filter-item select:focus,
.filter-item input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 统计卡片 - 现代渐变风格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.stat-card-title {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  font-weight: 600;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  transition: var(--transition-base);
}

.stat-card:hover .stat-card-icon {
  transform: scale(1.1);
}

.stat-card-icon.primary {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: var(--primary-color);
}

.stat-card-icon.success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: var(--success-color);
}

.stat-card-icon.warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: var(--warning-color);
}

.stat-card-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-card-footer {
  margin-top: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

/* Tab 切换 */
.tabs {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-light);
}

.tab-item {
  padding: var(--spacing-sm) 0;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: var(--transition-base);
  font-size: var(--font-size-base);
}

.tab-item:hover {
  color: var(--primary-color);
}

.tab-item.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 500;
}

/* 操作按钮组 */
.action-buttons {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

/* 详情面板 */
.detail-panel {
  background-color: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: fixed;
  top: 0;
  right: -800px;
  width: 800px;
  max-width: 92vw;
  height: 100vh;
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.detail-panel.open {
  right: 0;
}

.detail-panel-header {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.detail-panel-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.detail-panel-close {
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: var(--font-size-xl);
  line-height: 1;
}

.detail-panel-close:hover {
  color: var(--text-primary);
}
.close-back { display: none; }

.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.detail-panel-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
  flex-shrink: 0;
}

/* 遮罩层 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-base);
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

/* 详情字段 */
.detail-section {
  margin-bottom: var(--spacing-lg);
}

.detail-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--border-light);
}

.detail-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--spacing-sm) var(--spacing-md);
}

.detail-label {
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: 600;
}

.detail-value {
  color: var(--text-primary);
  font-size: 15px;
  word-break: break-all;
}

/* 方案A：宽面板双栏布局 */
.detail-grid-2col {
  display: grid;
  grid-template-columns: 110px 1fr 110px 1fr;
  gap: var(--spacing-sm) var(--spacing-md);
  align-items: baseline;
}
.detail-grid-2col .detail-value {
  word-break: break-word;
}
.detail-grid-2col .span-all {
  grid-column: 1 / -1;
}
.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--spacing-lg);
}
.form-grid-2col .span-all {
  grid-column: 1 / -1;
}
@media (max-width: 768px) {
  .detail-grid-2col {
    grid-template-columns: 100px 1fr;
  }
  .detail-grid-2col .span-all {
    grid-column: 1 / -1;
  }
  .form-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* 对话记录 */
.chat-history {
  background-color: var(--bg-gray);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  max-height: 300px;
  overflow-y: auto;
}

.chat-message {
  margin-bottom: var(--spacing-md);
}

.chat-message.user {
  text-align: right;
}

.chat-message-bubble {
  display: inline-block;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  max-width: 80%;
  word-break: break-word;
  text-align: left;
}

.chat-message.user .chat-message-bubble {
  background-color: var(--primary-color);
  color: white;
}

.chat-message.assistant .chat-message-bubble {
  background-color: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.chat-message-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.empty-state-text {
  font-size: var(--font-size-base);
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.pagination-info {
  margin-right: auto;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* 弹窗 Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}

.modal-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-gray);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* 表单元素在 modal 内的样式 */
.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body .form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.modal-body .form-group input,
.modal-body .form-group select {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--font-size-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-white);
  color: var(--text-primary);
  transition: var(--transition-base);
  font-family: inherit;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-body .form-group small {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}

.pagination-info {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin-right: var(--spacing-md);
}

.pagination-btn {
  padding: 4px 12px;
  font-size: var(--font-size-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-base);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.pagination-btn.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 登录页 - 现代渐变风格 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  border-radius: 50%;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  border-radius: 50%;
}

.login-card {
  width: 420px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  padding: var(--spacing-2xl);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-title {
  text-align: center;
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.login-subtitle {
  text-align: center;
  color: var(--text-tertiary);
  margin-bottom: var(--spacing-xl);
  font-size: var(--font-size-base);
}

/* 外部采集页 */
.external-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
}

.external-header {
  background-color: var(--primary-color);
  color: white;
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: center;
}

.external-chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.external-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
  background-color: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-md);
}

.external-input-area {
  display: flex;
  gap: var(--spacing-sm);
}

.external-input {
  flex: 1;
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  resize: none;
  height: 60px;
}

.external-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

/* 工具类 */
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-error { color: var(--error-color); }
.text-muted { color: var(--text-tertiary); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-logo span,
  .menu-item span {
    display: none;
  }
  .detail-panel {
    width: 100%;
    right: -100%;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
 * F7 骨架屏 / 加载占位（2026-06-30 新增）
 * ============================================ */
.skeleton-row {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
}
.skeleton-cell {
  background: linear-gradient(90deg, #f0f0f0 25%, #e3e3e3 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  border-radius: 6px;
  height: 14px;
  animation: skeleton-loading 1.4s ease infinite;
}
.skeleton-cell.short { width: 60px; }
.skeleton-cell.mid   { width: 120px; }
.skeleton-cell.long  { width: 200px; }
.skeleton-cell.flex1 { flex: 1; }
.skeleton-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e3e3e3 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  flex-shrink: 0;
}
@keyframes skeleton-loading {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
/* 表格骨架屏 */
.skeleton-table tbody td {
  padding: 14px 12px;
}
.skeleton-table .skeleton-cell {
  display: block;
}

/* ============================================
 * U2 空状态增强（2026-06-30 新增）
 * ============================================ */
.empty-state {
  padding: 56px var(--spacing-xl);
  text-align: center;
}
.empty-state-icon {
  font-size: 64px;
  margin-bottom: var(--spacing-md);
  opacity: 0.7;
  filter: grayscale(0.2);
  animation: empty-float 3s ease-in-out infinite;
}
@keyframes empty-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.empty-state-text {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.empty-state-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ============================================
 * U6/U7 视觉统一（2026-06-30 新增）
 * - emoji 仅用于空状态/欢迎场景，列表/按钮逐步替换为 SVG/纯文本
 * - 主色 #3b82f6 一致使用 var(--primary-color)
 * ============================================ */
.btn [data-icon] {
  margin-right: 4px;
  font-style: normal;
}
/* 统一阶段标签颜色（U4 同步统一） */
.tag.tag-primary { background: var(--primary-light); color: var(--primary-active); border: 1px solid var(--primary-color); }
.tag.tag-success { background: var(--success-light); color: #047857; border: 1px solid var(--success-color); }
.tag.tag-warning { background: var(--warning-light); color: #b45309; border: 1px solid var(--warning-color); }
.tag.tag-default { background: #f3f4f6; color: var(--text-secondary); border: 1px solid var(--border-color); }

/* ============================================
 * U1 移动端适配增强 — 底部Tab + 抽屉菜单（2026-07-10 重构）
 * ============================================ */

/* 汉堡按钮：电脑端隐藏，手机端显示 */
.header-hamburger {
  display: none;
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 底部 Tab 栏：电脑端隐藏 */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 768px) {
  /* 布局改为纵向 */
  .layout { flex-direction: column; }

  /* 侧边栏改为抽屉菜单 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
  }
  .sidebar.mobile-drawer-open {
    transform: translateX(0);
  }
  /* 抽屉打开时，菜单恢复纵向布局 */
  .sidebar-logo,
  .sidebar-menu {
    display: block;
    overflow: visible;
  }
  .sidebar-logo {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
  }
  .sidebar-menu {
    padding: 8px 0;
  }
  .menu-group,
  .menu-group-title,
  .menu-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 10px 16px;
    white-space: nowrap;
  }
  .menu-group-title {
    display: block;
    font-size: 13px;
  }
  .menu-item-icon { margin-right: 8px; }

  /* 抽屉遮罩 */
  .sidebar.mobile-drawer-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 260px;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: -1;
  }

  /* 汉堡按钮显示 */
  .header-hamburger {
    display: block;
  }
  .header-username {
    display: none;
  }

  /* 主内容区 */
  .main-content { width: 100%; }

  /* 表格横向滚动 */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table { min-width: 600px; }

  /* 筛选栏：紧凑布局 */
  .filter-bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px !important;
    padding: 8px 10px !important;
  }
  .filter-item { margin-bottom: 0 !important; flex: 1 1 calc(50% - 3px); min-width: 0; }
  /* 搜索框占满整行 */
  .filter-item[style*="flex: 1"] { flex: 1 1 100% !important; }
  /* label 改为下拉框内的前缀文字 */
  .filter-item label { display: none !important; }
  /* 下拉框默认选项显示分类名 */
  .filter-item select option:first-child { color: var(--text-secondary); }
  /* 下拉和输入框 16px 防 iOS 缩放 */
  .filter-item select, .filter-item input { font-size: 16px !important; padding: 6px 10px !important; width: 100%; }
  /* 按钮行：小按钮 */
  .filter-bar > .btn { flex: 0 0 auto; min-height: 36px; font-size: 13px; padding: 4px 12px; }

  /* 详情面板全屏，覆盖底部Tab栏 */
  .detail-panel {
    width: 100% !important;
    max-width: 100%;
    border-radius: 0;
    z-index: 2000;
  }
  .detail-grid {
    grid-template-columns: 1fr !important;
  }
  .detail-grid-2col {
    grid-template-columns: 100px 1fr !important;
  }
  .form-grid-2col {
    grid-template-columns: 1fr !important;
  }

  /* 详情面板返回按钮（手机端显示） */
  .close-x { display: none; }
  .close-back { display: inline; font-size: 15px; font-weight: 500; color: var(--text-primary); }
  .detail-panel-header {
    padding: 12px 16px;
  }
  .detail-panel-title {
    font-size: 16px;
  }
  .detail-panel-body {
    padding: 12px 16px;
  }

  /* 详情面板底部按钮撑满 */
  .detail-panel-footer {
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .detail-panel-footer .btn {
    flex: 1;
    min-height: 44px;
  }

  /* 手机端留言区输入框 16px 防 iOS 缩放 */
  #msgInput, textarea[id^="replyInput_"] {
    font-size: 16px !important;
  }

  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .stats-grid { grid-template-columns: 1fr; }
  .batch-bar { flex-wrap: wrap; gap: 8px; }

  /* 底部 Tab 栏 */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
  }
  .mobile-tab.active {
    color: var(--primary-color);
  }
  .mobile-tab-icon {
    font-size: 20px;
    line-height: 1;
  }
  .mobile-tab-label {
    font-size: 11px;
    line-height: 1;
  }

  /* 子菜单弹窗 */
  .mobile-tab-popup {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    border: 1px solid #f0f0f0;
    min-width: 200px;
    z-index: 1001;
    overflow: hidden;
    padding: 4px 0;
  }
  .mobile-tab-popup-item {
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
    white-space: nowrap;
  }
  .mobile-tab-popup-item:active {
    background: #f5f7fa;
  }
  .mobile-tab-popup-item + .mobile-tab-popup-item {
    border-top: 1px solid #f5f5f5;
  }

  /* 内容区底部留白，避免被Tab栏遮挡 */
  .content {
    padding-bottom: 70px;
  }

  /* 桌面端表格隐藏，手机端显示卡片 */
  .table-container { display: none; }
  .mobile-card-list { display: block !important; }
}

/* 手机端卡片样式 */
@media (max-width: 768px) {
  .m-card {
    background: white;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
    cursor: pointer;
    transition: box-shadow 0.2s;
  }
  .m-card:active {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  }
  .m-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  .m-card-code {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .m-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
  }
  .m-card-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 6px;
  }
  .m-card-unit {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .m-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .m-card-people {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
  }
  .m-card-status {
    margin-bottom: 10px;
  }
  .m-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  /* 卡片内标签和按钮统一尺寸 */
  .m-card-actions .btn-sm,
  .m-card-actions .tag {
    min-height: auto !important;
    font-size: 13px !important;
    padding: 4px 12px !important;
    border-radius: 8px !important;
    line-height: 1.2 !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 480px) {
  .header { padding: 0 12px; }
  .content { padding: 12px; }
  .btn { font-size: 13px; padding: 6px 12px; }
}

/* ============================================
 * 第2步：手机端通用样式优化（2026-07-10）
 * ============================================ */
@media (max-width: 768px) {
  /* 正文字号 14px → 15px，手机看更清晰 */
  body { font-size: 15px; }
  td { font-size: 15px; padding: 10px; }
  th { font-size: 13px; padding: 10px; }

  /* 按钮高度 ≥ 44px，手指触控 */
  .btn { min-height: 44px; font-size: 15px; padding: 10px 16px; }
  .btn-sm { min-height: 40px; font-size: 14px; padding: 8px 14px; }

  /* 输入框/下拉框触控友好 */
  .form-input, .filter-item select, .filter-item input {
    min-height: 44px;
    font-size: 15px;
  }

  /* 内容区间距紧凑 */
  .content { padding: 12px; }

  /* 卡片/表格容器间距 */
  .table-container { border-radius: 8px; }

  /* 标签稍微放大 */
  .tag { font-size: 12px; padding: 3px 8px; }

  /* 详情面板字号 */
  .detail-value { font-size: 15px; }
  .detail-label { font-size: 13px; }
  .form-label { font-size: 14px; }

  /* 筛选栏间距 */
  .filter-bar { gap: 8px; padding: 10px 12px; }

  /* 分页按钮触控 */
  .pagination button, .pagination a {
    min-height: 40px;
    min-width: 40px;
    font-size: 14px;
  }

  /* 页面标题 */
  .page-title, .card-title { font-size: 16px; }
  .header-title { font-size: 17px; font-weight: 600; }

  /* 空状态 */
  .empty-state-icon { font-size: 40px; }
  .empty-state-text { font-size: 16px; }
}
