﻿/* CRM 系统全局样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --bg: #f8fafc;
  --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%);
  --sidebar-w: 260px;
  --header-h: 64px;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --radius: 12px;
}

body { font-family: 'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== 侧边栏美化 ===== */
.sidebar {
  width: var(--sidebar-w); 
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex; flex-direction: column; 
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; 
  transition: width .3s ease;
  overflow: hidden;
}
/* 侧边栏顶部渐变装饰条 */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
}

.sidebar-logo {
  padding: 0 20px; height: var(--header-h); 
  display: flex; align-items: center;
  gap: 12px; 
  border-bottom: 1px solid rgba(255,255,255,.08);
  position: relative;
}
.sidebar-logo::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20px; right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.1), transparent);
}
.logo-icon { 
  width: 38px; height: 38px; 
  background: linear-gradient(135deg, #6366f1, #8b5cf6); 
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center; 
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.logo-icon svg { width: 20px; height: 20px; fill: #fff; }
.logo-text { font-size: 16px; font-weight: 700; color: #f1f5f9; white-space: nowrap; letter-spacing: .02em; }

/* 导航区域 */
.sidebar-nav { 
  flex: 1; 
  padding: 16px 0; 
  overflow-y: auto;
  overflow-x: hidden;
}
/* 美化滚动条 */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

.nav-group { padding: 6px 0; margin: 0 12px; }
.nav-group + .nav-group {
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 12px;
  margin-top: 6px;
}
.nav-group-title { 
  padding: 6px 12px; 
  font-size: 10.5px; font-weight: 600; 
  color: #6366f1; 
  text-transform: uppercase; 
  letter-spacing: .08em;
  opacity: 0.9;
}
.nav-item { 
  display: flex; align-items: center; gap: 12px; 
  padding: 10px 14px; 
  color: #94a3b8;
  cursor: pointer; 
  transition: all .2s ease;
  border-radius: 10px;
  margin: 2px 6px;
  border-left: none;
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  border-radius: 0 3px 3px 0;
  transition: height .2s ease;
}
.nav-item:hover { 
  background: rgba(99, 102, 241, .15); 
  color: #e2e8f0; 
}
.nav-item:hover::before { height: 20px; }
.nav-item.active { 
  background: linear-gradient(90deg, rgba(99, 102, 241, .25), rgba(139, 92, 246, .15)); 
  color: #fff; 
  font-weight: 500;
}
.nav-item.active::before { height: 24px; }
.nav-item.active::after {
  content: '';
  position: absolute;
  right: 10px;
  width: 6px; height: 6px;
  background: #6366f1;
  border-radius: 50%;
  box-shadow: 0 0 8px #6366f1;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; fill: currentColor; transition: transform .2s; }
.nav-item:hover svg { transform: scale(1.1); }
.nav-item .label { font-size: 14px; flex: 1; }
.nav-badge { 
  background: linear-gradient(135deg, #ef4444, #f97316); 
  color: #fff; 
  font-size: 10px; 
  padding: 2px 7px; 
  border-radius: 20px; 
  min-width: 20px; 
  text-align: center;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* 用户信息区域 */
.sidebar-footer { 
  padding: 16px 20px; 
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.2);
}
.user-card { display: flex; align-items: center; gap: 12px; }
.user-avatar { 
  width: 40px; height: 40px; 
  background: linear-gradient(135deg, #6366f1, #8b5cf6); 
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center; 
  color: #fff; font-size: 15px; font-weight: 600; 
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.user-info .name { font-size: 14px; color: #f1f5f9; font-weight: 500; }
.user-info .role { font-size: 11px; color: #6366f1; font-weight: 500; }
.btn-logout { 
  margin-left: auto; 
  background: rgba(255,255,255,.05); 
  border: none; 
  color: #64748b; 
  cursor: pointer; 
  padding: 8px; 
  border-radius: 8px; 
  transition: all .2s;
}
.btn-logout:hover { 
  background: rgba(239, 68, 68, .2); 
  color: #ef4444;
}
.btn-logout svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.sidebar-brand {
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 4px;
}
.sidebar-brand a {
  display: block;
  font-size: 10px;
  color: #475569;
  text-decoration: none;
  text-align: center;
  line-height: 1.4;
}
.sidebar-brand a:hover {
  color: #2563eb;
}

/* ===== 主内容区 ===== */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.header {
  height: var(--header-h); 
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.header-title { font-size: 18px; font-weight: 600; color: var(--text); flex: 1; }
.header-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 28px 40px; flex: 1; }

/* ===== 通用组件 ===== */
.card { 
  background: #fff; 
  border-radius: var(--radius); 
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.04);
  overflow: hidden;
}
.card-header { 
  padding: 18px 22px; 
  border-bottom: 1px solid var(--border); 
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, #fafbfc, #fff);
}
.card-header h3 { font-size: 15px; font-weight: 600; flex: 1; }
.card-body { padding: 22px; }

/* 统计卡片网格 */
.stat-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
  gap: 20px; 
  margin-bottom: 28px; 
}
/* 统计卡片美化 */
.stat-card { 
  background: linear-gradient(145deg, #fff, #fafbfc);
  border-radius: 16px; 
  padding: 22px; 
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.03);
  display: flex; align-items: flex-start; gap: 16px;
  transition: all .25s ease;
  border: 1px solid rgba(0,0,0,.04);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: linear-gradient(135deg, rgba(99,102,241,.05), transparent);
  border-radius: 0 0 0 100%;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(99,102,241,.15);
  border-color: rgba(99,102,241,.2);
}
.stat-icon { 
  width: 52px; height: 52px; 
  border-radius: 14px; 
  display: flex; align-items: center; justify-content: center; 
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.stat-icon svg { width: 26px; height: 26px; fill: #fff; }
.stat-icon.blue { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-icon.cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 12px; margin-top: 6px; font-weight: 500; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===== 按钮 ===== */
.btn { 
  display: inline-flex; align-items: center; gap: 7px; 
  padding: 10px 18px; 
  border-radius: 10px; 
  font-size: 14px; font-weight: 500; 
  cursor: pointer; border: none; 
  transition: all .2s ease; 
  white-space: nowrap; 
  letter-spacing: .01em;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { 
  background: linear-gradient(135deg, #6366f1, #4f46e5); 
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.btn-primary:hover { 
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99,102,241,.4);
}
.btn-success { 
  background: linear-gradient(135deg, #10b981, #059669); 
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,.3);
}
.btn-success:hover { 
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}
.btn-danger { 
  background: linear-gradient(135deg, #ef4444, #dc2626); 
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,.3);
}
.btn-danger:hover { 
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
}
.btn-outline { 
  background: #fff; color: var(--text); 
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 4px rgba(0,0,0,.04);
}
.btn-outline:hover { 
  border-color: var(--primary); 
  color: var(--primary);
  background: var(--primary-light);
}
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 9px; border-radius: 10px; }
.btn-secondary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 12px rgba(139,92,246,.3);
}
.btn-secondary:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139,92,246,.4);
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.btn-icon-svg { margin-right: 6px; }

/* ===== 表格 ===== */
.table-wrap { 
  overflow-x: auto; 
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; }
thead th { 
  background: linear-gradient(180deg, #f8fafc, #f1f5f9); 
  font-size: 12px; font-weight: 600; 
  color: var(--text-muted); 
  padding: 14px 16px; 
  text-align: left; 
  border-bottom: 1px solid var(--border); 
  white-space: nowrap;
  letter-spacing: .02em;
}
tbody tr { transition: all .15s ease; }
tbody tr:hover { background: linear-gradient(90deg, var(--primary-light), #fff); }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td:first-child { border-left: 3px solid var(--primary); padding-left: 13px; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: #374151; letter-spacing: .01em; }
.form-control { 
  padding: 11px 14px; 
  border: 1.5px solid #e5e7eb; 
  border-radius: 10px; 
  font-size: 14px; 
  color: var(--text); 
  outline: none; 
  transition: all .2s ease; 
  width: 100%; 
  background: #fff;
}
.form-control:focus { 
  border-color: var(--primary); 
  box-shadow: 0 0 0 4px rgba(99,102,241,.1);
}
.form-control::placeholder { color: #9ca3af; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ===== 筛选栏 ===== */
.filter-bar { 
  display: flex; gap: 12px; 
  flex-wrap: wrap; 
  align-items: center; 
  margin-bottom: 20px;
  padding: 16px 20px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  border: 1px solid var(--border);
}
.filter-bar .form-control { width: auto; min-width: 150px; padding: 9px 14px; }
.search-box { position: relative; }
.search-box input { padding-left: 40px; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: #94a3b8; }

/* ===== 徽标/状态 ===== */
.badge { 
  display: inline-flex; align-items: center; gap: 5px; 
  padding: 4px 10px; 
  border-radius: 20px; 
  font-size: 12px; font-weight: 600;
  letter-spacing: .01em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-completed, .badge-paid { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #15803d; }
.badge-potential { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4f46e5; }
.badge-inactive { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); color: #64748b; }
.badge-lost, .badge-cancelled { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #dc2626; }
.badge-pending, .badge-draft { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }
.badge-confirmed, .badge-partial { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #0891b2; }
.badge-production { background: #fae8ff; color: #7c3aed; }
.badge-shipped { background: #ecfdf5; color: #059669; }
.badge-unpaid { background: #fef2f2; color: #dc2626; }
.level-A { color: #dc2626; font-weight: 700; }
.level-B { color: #d97706; font-weight: 700; }
.level-C { color: #2563eb; font-weight: 600; }
.level-D { color: #64748b; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; gap: 6px; padding: 20px 0; justify-content: flex-end; }
.pagination .page-info { color: var(--text-muted); font-size: 13px; margin-right: 12px; }
.pagination .page-btn {
  min-width: 36px; height: 36px;
  padding: 0 12px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.pagination .page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.pagination .page-btn.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.pagination .page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.page-btn { width: 32px; height: 32px; border: 1.5px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: all .15s; color: var(--text); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== 模态框 ===== */
.modal-overlay { 
  position: fixed; inset: 0; 
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(4px);
  z-index: 1000; 
  display: flex; align-items: center; justify-content: center; 
  padding: 20px; 
  opacity: 0; pointer-events: none; 
  transition: opacity .25s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal { 
  background: #fff; 
  border-radius: 16px; 
  width: 100%; max-width: 640px; 
  max-height: 90vh; 
  display: flex; flex-direction: column; 
  transform: translateY(30px) scale(.95); 
  transition: all .3s cubic-bezier(.34, 1.56, .64, 1);
  box-shadow: 0 25px 80px rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.1);
}
.modal-overlay.show .modal { transform: none; }
.modal.modal-lg { max-width: 820px; }
.modal.modal-xl { max-width: 1200px; }
.modal.modal-xxl { max-width: 1200px; width: 1200px; }

/* 订单明细表格 */
.order-items-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.order-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.order-items-table thead {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}
.order-items-table th,
.order-items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}
.order-items-table th {
  font-weight: 600;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}
.order-items-table tbody tr:hover {
  background: #f8fafc;
}
.order-items-table select,
.order-items-table input {
  font-size: 13px;
}

/* 合同关联提示 */
.contract-info {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #7dd3fc;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.contract-info .contract-amount {
  font-size: 16px;
  font-weight: 600;
  color: #0369a1;
}
.contract-info .contract-balance {
  color: #16a34a;
  font-weight: 600;
}
.contract-info .contract-balance.warning {
  color: #f59e0b;
}
.contract-info .contract-balance.danger {
  color: #dc2626;
}
.modal-header { 
  padding: 20px 24px; 
  border-bottom: 1px solid var(--border); 
  display: flex; align-items: center; gap: 12px; 
  flex-shrink: 0;
  background: linear-gradient(180deg, #fafbfc, #fff);
  border-radius: 16px 16px 0 0;
}
.modal-header h3 { font-size: 17px; font-weight: 600; flex: 1; }
.modal-close { 
  background: rgba(0,0,0,.04); 
  border: none; cursor: pointer; 
  color: #64748b; 
  padding: 8px; border-radius: 8px; 
  transition: all .2s; 
  display: flex; align-items: center; justify-content: center; 
  flex-shrink: 0; min-width: 36px; min-height: 36px;
}
.modal-close:hover { 
  background: rgba(239,68,68,.1); 
  color: var(--danger);
}
.modal-close svg { width: 20px; height: 20px; fill: currentColor; display: block; pointer-events: none; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { 
  padding: 16px 24px; 
  border-top: 1px solid var(--border); 
  display: flex; align-items: center; justify-content: flex-end; gap: 12px; 
  flex-shrink: 0;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border-radius: 0 0 16px 16px;
}

/* ===== 空状态 ===== */
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state svg { width: 64px; height: 64px; fill: #cbd5e1; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== Toast ===== */
#toastContainer { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; }
.toast { 
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #f1f5f9; 
  padding: 14px 20px; 
  border-radius: 12px; 
  font-size: 14px; 
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  display: flex; align-items: center; gap: 12px; 
  min-width: 280px; 
  animation: slideIn .3s cubic-bezier(.34, 1.56, .64, 1);
  border: 1px solid rgba(255,255,255,.1);
}
.toast svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.toast.success { border-left: 4px solid var(--success); }
.toast.success svg { color: var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.error svg { color: var(--danger); }
.toast.info { border-left: 4px solid var(--info); }
.toast.info svg { color: var(--info); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: none; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ===== 提醒角标 ===== */
.remind-dot { display: inline-flex; width: 8px; height: 8px; background: #ef4444; border-radius: 50%; }

/* ===== 图表容器 ===== */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-wrap { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--card-shadow); }
.chart-wrap h4 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.chart-container { position: relative; height: 240px; }

/* ===== 快捷入口 ===== */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.quick-btn { display: flex; align-items: center; gap: 8px; padding: 10px 18px; background: #fff; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13.5px; color: var(--text); transition: all .15s; }
.quick-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.quick-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ===== 汉堡菜单按钮 ===== */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background .15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--primary-light); }
.sidebar-toggle svg { width: 22px; height: 22px; fill: currentColor; display: block; }

/* 侧边栏遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ===== 响应式 ===== */

/* ---------- 平板 ≤1024px ---------- */

/* ===== 统一样式增强 ===== */

/* 统一文本颜色 */
.text-primary { color: var(--primary) !important; }
.text-success { color: #16a34a !important; }
.text-danger { color: #dc2626 !important; }
.text-warning { color: #d97706 !important; }
.text-info { color: #0891b2 !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: #64748b !important; }
.text-dark { color: var(--text) !important; }

/* 统一字体大小 */
.text-xs { font-size: 11px !important; }
.text-sm { font-size: 12px !important; }
.text-base { font-size: 14px !important; }
.text-lg { font-size: 16px !important; }
.text-xl { font-size: 18px !important; }
.text-2xl { font-size: 20px !important; }
.text-bold { font-weight: 600 !important; }
.text-semibold { font-weight: 500 !important; }

/* 统一对齐 */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* 统一间距 */
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.p-1 { padding: 4px !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }

/* 统一边框 */
.rounded { border-radius: 8px !important; }
.rounded-sm { border-radius: 4px !important; }
.rounded-lg { border-radius: 12px !important; }
.border { border: 1px solid var(--border) !important; }
.border-primary { border-color: var(--primary) !important; }

/* 统一背景 */
.bg-primary { background: var(--primary-light) !important; }
.bg-success { background: #f0fdf4 !important; }
.bg-danger { background: #fef2f2 !important; }
.bg-warning { background: #fffbeb !important; }
.bg-muted { background: #f8fafc !important; }

/* 表格单元格统一样式 */
.table-cell { padding: 12px 16px !important; font-size: 14px !important; vertical-align: middle !important; border-bottom: 1px solid var(--border) !important; }
.table-cell-center { padding: 12px 16px !important; font-size: 14px !important; vertical-align: middle !important; border-bottom: 1px solid var(--border) !important; text-align: center !important; }
.table-cell-muted { padding: 12px 16px !important; font-size: 12px !important; color: var(--text-muted) !important; vertical-align: middle !important; border-bottom: 1px solid var(--border) !important; }

/* 表格加载/空状态统一 */
.table-loading td, .table-empty td { text-align: center !important; padding: 40px 20px !important; color: var(--text-muted) !important; font-size: 14px !important; }
.table-error td { text-align: center !important; padding: 40px 20px !important; color: #dc2626 !important; font-size: 14px !important; }

/* 金额显示统一 */
.amount { font-weight: 600 !important; color: var(--primary) !important; }
.amount-paid { color: #16a34a !important; font-weight: 600 !important; }
.amount-pending { color: #dc2626 !important; font-weight: 600 !important; }

/* 排序指示器 */
.sort-indicator { display: inline-flex !important; align-items: center !important; gap: 4px !important; cursor: pointer !important; user-select: none !important; }
.sort-indicator:hover { color: var(--primary) !important; }

/* 列表卡片样式 */
.list-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: all .15s ease;
}
.list-card:hover {
  box-shadow: 0 4px 12px rgba(99,102,241,.1);
  border-color: rgba(99,102,241,.2);
}

/* 状态标签统一 */
.status-tag {
  display: inline-flex !important;
  align-items: center !important;
  padding: 4px 10px !important;
  border-radius: 20px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

/* 加载动画统一 */
.loading-spinner {
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  border: 2px solid var(--border) !important;
  border-top-color: var(--primary) !important;
  border-radius: 50% !important;
  animation: spin .8s linear infinite !important;
}

/* 操作按钮组 */
.action-group {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

/* 表格hover效果增强 */
tbody tr {
  transition: background .15s ease, transform .1s ease;
}
tbody tr:hover {
  background: linear-gradient(90deg, var(--primary-light), #fff);
}
tbody tr:hover td:first-child {
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}

/* 筛选栏内元素统一 */
.filter-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}
.filter-label {
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--text) !important;
  white-space: nowrap !important;
}
.filter-separator {
  color: var(--text-muted) !important;
  font-size: 12px !important;
}

/* 统计数值样式 */
.stat-number {
  font-size: 28px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  line-height: 1.2 !important;
}
.stat-number-lg {
  font-size: 36px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  line-height: 1.2 !important;
}

/* 分隔线 */
.divider {
  height: 1px !important;
  background: var(--border) !important;
  margin: 16px 0 !important;
}

/* 弹性布局 */
.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }

/* 网格布局 */
.grid { display: grid !important; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* 溢出隐藏 */
.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }

/* 宽度 */
.w-full { width: 100% !important; }

/* 空状态增强 */
.empty-state-box {
  padding: 60px 20px !important;
  text-align: center !important;
  color: var(--text-muted) !important;
  background: #fafbfc !important;
  border-radius: var(--radius) !important;
  margin: 20px 0 !important;
}
.empty-state-box svg {
  width: 56px !important;
  height: 56px !important;
  fill: #cbd5e1 !important;
  margin-bottom: 12px !important;
}
.empty-state-box p {
  font-size: 14px !important;
}

/* 消息提示框 */
.alert {
  padding: 12px 16px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 16px !important;
}
.alert-success {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7) !important;
  color: #15803d !important;
  border: 1px solid #bbf7d0 !important;
}
.alert-danger {
  background: linear-gradient(135deg, #fef2f2, #fee2e2) !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}
.alert-warning {
  background: linear-gradient(135deg, #fffbeb, #fef3c7) !important;
  color: #d97706 !important;
  border: 1px solid #fde68a !important;
}
.alert-info {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe) !important;
  color: #0891b2 !important;
  border: 1px solid #bae6fd !important;
}

/* 折叠面板 */
.panel {
  background: #fff !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  margin-bottom: 12px !important;
  overflow: hidden !important;
}
.panel-header {
  padding: 14px 18px !important;
  background: linear-gradient(180deg, #fafbfc, #fff) !important;
  border-bottom: 1px solid var(--border) !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  transition: background .15s !important;
}
.panel-header:hover {
  background: var(--primary-light) !important;
}
.panel-header h4 {
  font-size: 14px !important;
  font-weight: 600 !important;
  flex: 1 !important;
}
.panel-body {
  padding: 18px !important;
}


@media (max-width: 1024px) {
  .modal.modal-xl, .modal.modal-xxl { max-width: 95vw; }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px 20px; }
}

/* ---------- 手机 ≤768px ---------- */
@media (max-width: 768px) {
  /* 侧边栏 */
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    box-shadow: none;
  }
  .sidebar.open {
    transform: none;
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .main { margin-left: 0; }

  /* 汉堡菜单 */
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

  /* Header */
  .header { padding: 0 12px; gap: 8px; }
  .header-title { font-size: 15px; }
  .header-actions .btn {
    padding: 7px 10px;
  }
  /* 只保留图标，隐藏文字（利用按钮中 svg 和文本节点的特性） */
  .header-actions .btn { font-size: 0; gap: 0; }
  .header-actions .btn svg { width: 18px; height: 18px; }

  /* 内容区 */
  .page-content { padding: 12px; }

  /* 统计卡片 */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 10px; }
  .stat-icon svg { width: 20px; height: 20px; }
  .stat-value { font-size: 22px; }

  /* 表单 */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }

  /* 图表 */
  .chart-row { grid-template-columns: 1fr; }

  /* 筛选栏 */
  .filter-bar { gap: 6px; }
  .filter-bar .form-control { min-width: 0 !important; flex: 1 1 auto; width: auto !important; }
  .search-box { flex: 1 1 100%; }
  .search-box input { width: 100% !important; }

  /* 表格 */
  .table-wrap { margin: 0 -12px; }
  table { font-size: 12px; }
  thead th { padding: 8px 10px; font-size: 11px; }
  tbody td { padding: 8px 10px; font-size: 12px; }

  /* 分页 */
  .pagination { flex-wrap: wrap; justify-content: center; gap: 4px; padding: 12px 0; }
  .pagination .page-info { width: 100%; text-align: center; margin-right: 0; margin-bottom: 4px; }

  /* 模态框 */
  .modal:not(.modal-xl):not(.modal-xxl) { max-width: calc(100vw - 24px); margin: 12px; max-height: 85vh; border-radius: 12px; }
  .modal.modal-lg { max-width: calc(100vw - 24px); }
  .modal.modal-xl, .modal.modal-xxl { max-width: 1150px !important; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; min-width: 0; }

  /* 快捷入口 */
  .quick-actions { gap: 8px; }
  .quick-btn { padding: 8px 12px; font-size: 12.5px; }
  .quick-btn svg { width: 14px; height: 14px; }

  /* Toast */
  #toastContainer { top: 12px; right: 12px; left: 12px; }
  .toast { min-width: 0; width: 100%; font-size: 13px; }

  /* 空状态 */
  .empty-state { padding: 40px 16px; }
}

/* ---------- 小屏手机 ≤480px ---------- */
@media (max-width: 480px) {
  /* 统计卡片单列 */
  .stat-grid { grid-template-columns: 1fr; }

  /* Header */
  .header-title { font-size: 14px; }

  /* Card */
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }

  /* 表格横向滚动更友好 */
  .table-wrap { margin: 0 -14px; }

  /* 模态框 */
  .modal:not(.modal-xl):not(.modal-xxl):not(.modal-lg) { margin: 0; max-width: 100vw; max-height: 100vh; border-radius: 0; }
  .modal-header, .modal-body, .modal-footer { padding: 12px; }

  /* 筛选栏 select 改全宽 */
  .filter-bar .form-control { width: 100% !important; min-width: 0 !important; }

  /* 按钮 */
  .btn { padding: 7px 12px; font-size: 12.5px; }
  .btn-sm { padding: 5px 8px; font-size: 11.5px; }

  /* 侧边栏宽度 */
  .sidebar { width: 240px; }
}

/* ---------- 登录页适配 ---------- */
@media (max-width: 480px) {
  .login-box {
    width: calc(100vw - 32px);
    padding: 32px 24px;
    border-radius: 12px;
    margin: 16px;
  }
  .login-logo .icon { width: 52px; height: 52px; border-radius: 12px; }
  .login-logo .icon svg { width: 30px; height: 30px; }
  .login-logo h1 { font-size: 19px; }
}
@media (max-width: 380px) {
  .login-box { padding: 24px 18px; }
}

/* ---------- 通用响应式辅助类 ---------- */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .resp-grid-1 { grid-template-columns: 1fr !important; }
  .resp-row { grid-template-columns: 1fr !important; }
  .resp-order-footer { margin-right: 0 !important; flex-wrap: wrap; width: 100%; justify-content: center; }
  .resp-rank-header { flex-wrap: wrap; width: 100%; justify-content: flex-start; margin-top: 8px; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ===== 合同管理 ===== */
.contract-no {
  font-family: 'Consolas', monospace;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #475569;
}
.amount-highlight {
  font-weight: 600;
  color: #059669;
}
.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-info a {
  color: var(--primary);
  font-size: 13px;
}

/* ===== 资产到期 ===== */
.asset-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.asset-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--card-shadow);
  border: 2px solid transparent;
}
.asset-stat-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.asset-stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--primary-light);
}
.asset-stat-card .stat-icon svg { fill: var(--primary); }
.asset-stat-card.domain .stat-icon { background: #fef3c7; }
.asset-stat-card.domain .stat-icon svg { fill: #d97706; }
.asset-stat-card.server .stat-icon { background: #dbeafe; }
.asset-stat-card.server .stat-icon svg { fill: #2563eb; }
.asset-stat-card.wechat .stat-icon { background: #dcfce7; }
.asset-stat-card.wechat .stat-icon svg { fill: #16a34a; }
.asset-stat-card.email .stat-icon { background: #f3e8ff; }
.asset-stat-card.email .stat-icon svg { fill: #7c3aed; }
.asset-stat-card.ssl .stat-icon { background: #fce7f3; }
.asset-stat-card.ssl .stat-icon svg { fill: #db2777; }
.asset-stat-card.service .stat-icon { background: #e0f2fe; }
.asset-stat-card.service .stat-icon svg { fill: #0891b2; }
.asset-stat-card.total .stat-icon { background: #f1f5f9; }
.asset-stat-card.total .stat-icon svg { fill: #475569; }
.asset-stat-card .stat-info { flex: 1; min-width: 0; }
.asset-stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.asset-stat-card .stat-nums {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
}
.asset-stat-card .stat-total { font-weight: 600; color: var(--text); }
.asset-stat-card .stat-expire { color: var(--danger); }
.asset-stat-card .stat-warning { color: var(--warning); }
.asset-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.asset-type-badge.domain { background: #fef3c7; color: #92400e; }
.asset-type-badge.server { background: #dbeafe; color: #1e40af; }
.asset-type-badge.wechat { background: #dcfce7; color: #166534; }
.asset-type-badge.email { background: #f3e8ff; color: #6b21a8; }
.asset-type-badge.ssl { background: #fce7f3; color: #9d174d; }
.asset-type-badge.service { background: #e0f2fe; color: #075985; }
.asset-name { font-weight: 500; }
.help-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.input-group { display: flex; gap: 8px; }
.input-group .form-control { flex: 1; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}
.checkbox-label input { width: 16px; height: 16px; cursor: pointer; }

/* ===== AI获取文章样式 ===== */
.ai-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(139,92,246,.08));
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #6366f1;
}
.ai-tip svg { fill: #6366f1; flex-shrink: 0; }
.ai-examples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.ai-tag {
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
}
.ai-tag:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== 知识库 ===== */
.kb-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 120px);
}
.kb-filter-wrap {
  flex-shrink: 0;
}
.kb-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 12px 16px;
  flex-wrap: wrap;
}
.kb-filter-nav {
  flex: 1;
  min-width: 0;
}
.kb-category-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kb-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
  background: #f1f5f9;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.kb-cat-tag:hover {
  background: #e2e8f0;
  color: var(--text);
}
.kb-cat-tag.active {
  background: var(--primary);
  color: #fff;
}
.kb-cat-tag .kb-cat-actions {
  display: none;
  gap: 2px;
  margin-left: 4px;
}
.kb-cat-tag:hover .kb-cat-actions {
  display: flex;
}
.kb-cat-tag .kb-cat-actions button {
  padding: 2px 5px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  opacity: 0.8;
}
.kb-cat-tag .kb-cat-actions button:hover {
  opacity: 1;
  background: rgba(255,255,255,0.4);
}
.kb-cat-add {
  color: var(--primary);
  background: var(--primary-light);
  border: 1px dashed var(--primary);
}
.kb-cat-add:hover {
  background: var(--primary);
  color: #fff;
}
.kb-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.kb-filter-search {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
  min-width: 160px;
}
.kb-filter-search:focus { border-color: var(--primary); }

/* 分类下拉（旧版兼容） */
.kb-dropdown {
  position: relative;
}
.kb-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s;
}
.kb-dropdown-btn:hover { border-color: var(--primary); }
.kb-dropdown.open .kb-dropdown-btn { border-color: var(--primary); background: var(--primary-light); }
.kb-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
  padding: 6px;
  max-height: 340px;
  overflow-y: auto;
}
.kb-dropdown.open .kb-dropdown-menu { display: block; }
.kb-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
}
.kb-dropdown-item:hover { background: #f1f5f9; }
.kb-dropdown-item .dd-btns {
  margin-left: auto;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
}
.kb-dropdown-item:hover .dd-btns { opacity: 1; }
.kb-dropdown-item .dd-btns button {
  padding: 2px 6px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
  transition: background .12s;
}
.kb-dropdown-item .dd-btns button:hover { background: #e2e8f0; }
.kb-dd-add {
  color: var(--primary);
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 500;
}
.kb-dd-add:hover { background: var(--primary-light); }
.btn-icon-sm {
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-sm:hover { background: #f1f5f9; color: var(--text); }
.btn-icon-sm.btn-danger:hover { background: #fef2f2; color: var(--danger); }
.btn-icon-sm svg { width: 14px; height: 14px; fill: currentColor; }


.kb-main { flex: 1; min-width: 0; max-width: 1500px; }
.kb-article-list { display: flex; flex-direction: column; gap: 12px; }
.kb-article-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--card-shadow);
  border: 2px solid transparent;
}
.kb-article-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.article-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.article-title { font-size: 16px; font-weight: 600; color: var(--text); }
.article-category { font-size: 11px; color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.article-preview { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--text-muted); }
.article-meta .meta-item { display: flex; align-items: center; gap: 4px; }
.article-meta .meta-item svg { fill: currentColor; }
.article-meta .tags { gap: 4px; }
.article-meta .tag { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.article-meta .time { margin-left: auto; }
.kb-article-detail {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--card-shadow);
}
.article-actions-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article-actions-top .btn { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.article-actions-top .btn:hover { color: var(--primary); }
.kb-article-detail .article-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}
.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.article-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}
.article-body p { margin-bottom: 12px; }
.article-body h1, .article-body h2, .article-body h3 { margin: 20px 0 12px; font-weight: 600; }
.article-body ul, .article-body ol { padding-left: 24px; margin-bottom: 12px; }
.article-body li { margin-bottom: 6px; }
.article-body code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: Consolas, monospace; }
.article-body pre { background: #1e293b; color: #f1f5f9; padding: 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 16px; }
.article-body pre code { background: none; padding: 0; color: inherit; }
.article-body blockquote { border-left: 4px solid var(--primary); padding-left: 16px; color: var(--text-muted); margin: 16px 0; }

.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}
.editor-toolbar button {
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.editor-toolbar button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
textarea.form-control + .editor-toolbar {
  border-radius: 0 0 8px 8px;
  border-top: none;
}

/* 详情页面 */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; }
.detail-item span { font-size: 14px; color: var(--text); }
.action-btns { display: flex; gap: 4px; }

/* ===== 通用辅助 ===== */
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.table-container { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
.loading-cell, .empty-cell { text-align: center; padding: 40px !important; color: var(--text-muted); }
.filter-input { padding: 8px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13.5px; outline: none; min-width: 200px; transition: border-color .15s; }
.filter-input:focus { border-color: var(--primary); }
.filter-select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13.5px; background: #fff; cursor: pointer; outline: none; }
.filter-select:focus { border-color: var(--primary); }
.modal.modal-sm .modal-body { padding: 20px; }
.modal.modal-sm { max-width: 400px; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* 响应式知识库 */
@media (max-width: 768px) {
  .kb-filter-bar { padding: 8px 12px; gap: 8px; }
  .kb-filter-nav { width: 100%; }
  .kb-category-tags { gap: 6px; }
  .kb-cat-tag { padding: 5px 10px; font-size: 12px; }
  .kb-filter-actions { width: 100%; justify-content: flex-end; }
  .kb-filter-search { min-width: 120px; font-size: 12px; }
  .kb-article-detail { padding: 20px; }
  .article-detail-content { padding: 20px 24px; }
  .article-detail-container { max-width: 100%; }
  .article-meta-bar { flex-wrap: wrap; gap: 8px; }
  .detail-grid { grid-template-columns: 1fr; }
  .asset-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .asset-stats { grid-template-columns: 1fr; }
  .kb-article-detail .article-title { font-size: 14px; }
  .article-detail-header .article-title { font-size: 14px; }
  .article-detail-header { margin-bottom: 16px; padding-bottom: 12px; }
  .article-body { font-size: 14px; line-height: 1.7; }
  .article-meta { font-size: 11px; gap: 8px; }
  .kb-filter-actions { flex-wrap: wrap; gap: 6px; }
  .kb-filter-actions .btn { flex: 1; min-width: 60px; }
}

/* ===== AI 对话 ===== */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-welcome {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
}
.chat-welcome ul {
  padding-left: 20px;
  margin: 8px 0;
}
.chat-welcome li {
  margin-bottom: 4px;
}
.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.chat-message.user {
  flex-direction: row-reverse;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.chat-avatar.ai {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}
.chat-avatar.user {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}
.chat-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
}
.chat-bubble.user {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.ai {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.chat-bubble p { margin-bottom: 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol {
  padding-left: 20px;
  margin: 8px 0;
}
.chat-bubble li { margin-bottom: 4px; }
.chat-bubble code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: Consolas, monospace;
}
.chat-bubble pre {
  background: #1e293b;
  color: #f1f5f9;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}
.chat-bubble pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.chat-content {
  font-size: 14px;
  line-height: 1.7;
}
.chat-content p { margin-bottom: 10px; }
.chat-content strong { font-weight: 600; }
.chat-content em { font-style: italic; }
.chat-error {
  color: var(--danger);
  font-size: 14px;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 8px;
}
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}
.chat-typing span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}
.chat-input-area {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.chat-input-area textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  resize: none;
  outline: none;
  transition: border-color .2s;
}
.chat-input-area textarea:focus {
  border-color: var(--primary);
}
.chat-input-area .btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== AI 生成预览 ===== */
.ai-preview {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.ai-preview-header {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}
.ai-progress-bar {
  height: 4px;
  background: #e2e8f0;
}
.ai-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  width: 0%;
  transition: width .3s ease;
}
.ai-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ai-preview-item:last-child {
  border-bottom: none;
}
.ai-preview-item.loading { background: #fafafa; }
.ai-preview-item.success { background: #f0fdf4; }
.ai-preview-item.error { background: #fef2f2; }
.ai-item-status { font-size: 16px; }
.ai-item-topic { flex: 1; color: var(--text); }
.ai-item-status-text { color: var(--text-muted); font-size: 12px; }

/* ===== 文章详情优化 ===== */
.article-detail-container {
  max-width: 1490px;
  margin: 0 auto;
  padding-top: 0;
}
.article-detail-header {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.article-detail-header .article-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0;
  margin-top: 0;
  color: var(--text);
  text-align: center;
}
.article-detail-header .article-meta {
  display: flex !important;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  justify-content: center !important;
  padding-top: 8px;
}
.article-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.article-meta-item svg { width: 12px; height: 12px; opacity: 0.7; }
.article-detail-content {
  background: #fff;
  border-radius: 12px;
  padding: 16px 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
.article-body {
  font-size: 15px;
  line-height: 1.8;
  color: #374151;
}
.article-body p { margin-bottom: 16px; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  margin: 32px 0 16px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
}
.article-body h2 { font-size: 22px; border-bottom: 2px solid #e5e7eb; padding-bottom: 8px; }
.article-body h3 { font-size: 18px; }
.article-body h4 { font-size: 16px; }
.article-body ul, .article-body ol {
  padding-left: 28px;
  margin-bottom: 20px;
}
.article-body li { margin-bottom: 8px; }
.article-body code {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Fira Code', Consolas, monospace;
  color: #d946ef;
}
.article-body pre {
  background: #1e293b;
  color: #f1f5f9;
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 24px 0;
}
.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 14px;
  line-height: 1.6;
}
.article-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  background: #f8f5ff;
  border-radius: 0 12px 12px 0;
  margin: 24px 0;
  color: #6b7280;
  font-style: italic;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}
.article-body th, .article-body td {
  border: 1px solid #e5e7eb;
  padding: 12px 16px;
  text-align: left;
}
.article-body th {
  background: #f8fafc;
  font-weight: 600;
}
.article-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ===== 富文本编辑器 ===== */
.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.toolbar-divider {
  width: 1px;
  height: 24px;
  background: #e5e7eb;
  margin: 0 6px;
}
.toolbar-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  transition: all .15s ease;
}
.toolbar-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.toolbar-btn:active {
  transform: scale(0.95);
}
.toolbar-btn svg { fill: currentColor; }
.toolbar-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  outline: none;
}
.toolbar-select:focus {
  border-color: var(--primary);
}
.rich-editor {
  outline: none;
  font-size: 15px;
  line-height: 1.8;
  color: #374151;
}
.rich-editor:empty::before {
  content: attr(placeholder);
  color: #9ca3af;
  pointer-events: none;
}
.rich-editor h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 24px 0 16px;
  color: #1f2937;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 8px;
}
.rich-editor h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 20px 0 12px;
  color: #1f2937;
}
.rich-editor h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 16px 0 10px;
  color: #374151;
}
.rich-editor h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 14px 0 8px;
  color: #4b5563;
}
.rich-editor p {
  margin-bottom: 14px;
}
.rich-editor ul, .rich-editor ol {
  padding-left: 24px;
  margin-bottom: 14px;
}
.rich-editor li {
  margin-bottom: 6px;
}
.rich-editor blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  background: #f8f5ff;
  margin: 16px 0;
  color: #6b7280;
  font-style: italic;
  border-radius: 0 8px 8px 0;
}
.rich-editor pre {
  background: #1e293b;
  color: #f1f5f9;
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
}
.rich-editor code {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Fira Code', Consolas, monospace;
  color: #d946ef;
}
.rich-editor pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.rich-editor a {
  color: var(--primary);
  text-decoration: underline;
}
.rich-editor img {
  max-width: 100%;
  border-radius: 8px;
  margin: 12px 0;
}
.rich-editor hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 24px 0;
}
.rich-editor table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.rich-editor th, .rich-editor td {
  border: 1px solid #e5e7eb;
  padding: 10px 14px;
  text-align: left;
}
.rich-editor th {
  background: #f8fafc;
  font-weight: 600;
}
.char-count {
  font-size: 12px;
  color: #9ca3af;
  margin-right: auto;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .rich-toolbar {
    padding: 8px 12px;
    gap: 2px;
  }
  .toolbar-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .toolbar-divider {
    margin: 0 4px;
  }
}

/* ===== 到期提醒详情面板 ===== */
.remind-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.remind-list-wrap {
  flex: 1;
  min-width: 0;
}
.remind-detail-panel {
  width: 360px;
  flex-shrink: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  position: sticky;
  top: calc(var(--header-h) + 28px);
  max-height: calc(100vh - var(--header-h) - 56px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.remind-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}
.remind-detail-empty svg {
  margin-bottom: 16px;
  opacity: 0.5;
}
.remind-detail-empty p {
  font-size: 14px;
}
.remind-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc, #fff);
}
.remind-detail-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  word-break: break-word;
}
.remind-detail-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all .15s;
  flex-shrink: 0;
}
.remind-detail-close:hover {
  background: #f1f5f9;
  color: var(--text);
}
.remind-detail-close svg {
  fill: currentColor;
}
.remind-detail-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}
.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed #f1f5f9;
}
.detail-item:last-child {
  border-bottom: none;
}
.detail-item.full {
  flex-direction: column;
  gap: 8px;
}
.detail-item label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.detail-item span {
  font-size: 14px;
  color: var(--text);
  text-align: right;
}
.detail-notes {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  width: 100%;
}
.remind-detail-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.remind-detail-footer .btn {
  flex: 1;
  justify-content: center;
}
.remind-row {
  cursor: pointer;
  transition: all .15s;
}
.remind-row:hover {
  background: var(--primary-light) !important;
}
.remind-row.selected {
  background: rgba(99, 102, 241, 0.1) !important;
  border-left: 3px solid var(--primary);
}

@media (max-width: 1024px) {
  .remind-detail-panel {
    display: none;
  }
}

/* ===== 账号管理 ===== */
.acc-stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.acc-stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 140px;
}
.acc-stat-card.total {
  border-color: var(--primary);
  background: linear-gradient(135deg, #f0f1ff, #fff);
}
.acc-stat-icon {
  font-size: 24px;
}
.acc-stat-info {
  flex: 1;
}
.acc-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.acc-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 详情弹窗样式 */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed #f1f5f9;
}
.detail-row:last-child { border-bottom: none; }
.detail-row.full { flex-direction: column; gap: 8px; }
.detail-row label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 80px;
  flex-shrink: 0;
}
.detail-row span {
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}
.detail-row .pwd-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-row a {
  color: var(--primary);
  text-decoration: none;
}
.detail-row a:hover { text-decoration: underline; }

/* ===== 导出弹窗样式 ===== */
.export-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.export-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.export-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.export-section-title svg {
  fill: var(--primary);
}
.export-scope-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.radio-item:hover {
  background: #f0f1ff;
}
.radio-item input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.radio-item span {
  font-size: 14px;
  color: var(--text);
}
.export-scope-tip {
  padding: 12px 16px;
  background: #f0fdf4;
  border-radius: 8px;
  font-size: 13px;
  color: #166534;
}
.export-field-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.export-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
}
.export-field-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  font-size: 13px;
}
.export-field-item:hover {
  background: #f0f1ff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.export-field-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.export-field-item span {
  color: var(--text);
  flex: 1;
}
.export-field-item.custom {
  border: 1px dashed #e2e8f0;
}
.custom-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  flex-shrink: 0;
}
.export-field-count {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}
.export-save-path {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.export-save-path label {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.export-format-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 6px;
}
.export-format-info svg {
  fill: var(--text-muted);
  flex-shrink: 0;
}
.loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 导入弹窗样式 ===== */
.import-format-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #eff6ff;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
  margin-bottom: 16px;
}
.import-format-tip svg {
  fill: #1e40af;
  flex-shrink: 0;
}
.import-tips {
  margin-top: 16px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 12px;
}
.import-tips h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--text);
}
.import-tips ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ===== 导出格式选择 ===== */
.export-format-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.export-format-row > label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.format-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.format-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.format-radio:hover {
  background: #f0f1ff;
}
.format-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.format-label {
  font-weight: 600;
  color: var(--text);
}
.format-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== 下拉菜单样式 ===== */
.menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  transition: all .15s;
}
.menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========== 邮件管理样式 ========== */
.mail-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.mail-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all .15s;
}

.mail-tab:hover { background: var(--primary-light); color: var(--primary); }
.mail-tab.active { background: var(--primary); color: #fff; }

.mail-content { padding: 16px; }

.mail-list { background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow); }
.mail-list-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.mail-list-body { min-height: 200px; }

.mail-item {
  display: grid;
  grid-template-columns: 1fr 2fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.mail-item:hover { background: var(--bg); }
.mail-item.unread { background: var(--primary-light); font-weight: 500; }
.mail-item-from { font-weight: 500; }
.mail-item-subject { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item-date { color: var(--text-muted); font-size: 12px; }
.mail-attachment { color: var(--warning); }
.mail-status { font-size: 12px; }

.compose-form, .settings-section { max-width: 1190px; margin: 0 auto; }
.compose-form .form-group, .settings-section .form-group { margin-bottom: 16px; }
.compose-form label, .settings-section label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-weight: 500; }
.compose-form input, .compose-form select, .compose-form textarea,
.settings-section input, .settings-section select, .settings-section textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.compose-form textarea, .settings-section textarea { resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.batch-info {
  background: var(--primary-light);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.batch-info code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
  font-size: 12px;
}

.customer-multi-select {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.customer-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 4px;
}
.customer-checkbox:hover { background: var(--bg); }
.customer-email { color: var(--text-muted); font-size: 12px; margin-left: auto; }

.template-list { display: flex; flex-direction: column; gap: 8px; }
.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}
.template-name { font-weight: 500; }
.template-subject { color: var(--text-muted); font-size: 12px; }
.template-actions { display: flex; gap: 8px; }

.email-detail-header h3 { margin-bottom: 12px; }
.email-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.email-meta div { margin-bottom: 4px; }
.email-detail-content { line-height: 1.8; }
.email-detail-content.html { padding: 16px; background: #fff; border-radius: 8px; }
.email-detail-content pre { white-space: pre-wrap; word-break: break-all; }

.btn-danger { background: var(--danger); color: #fff; }

.success { color: var(--success); padding: 8px 12px; background: #ecfdf5; border-radius: 8px; margin-top: 12px; }
.error { color: var(--danger); padding: 8px 12px; background: #fef2f2; border-radius: 8px; margin-top: 12px; }
.warning { color: var(--warning); padding: 8px 12px; background: #fffbeb; border-radius: 8px; }

#configStatus { margin-top: 12px; }

/* ========== 邮件管理 美化版 ========== */
.mail-layout {
  display: flex;
  height: calc(100vh - var(--header-h) - 40px);
  background: var(--bg);
  gap: 0;
}

/* 左侧导航 */
.mail-sidebar {
  width: 200px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
}

.mail-compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.mail-compose-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}
.mail-compose-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.mail-nav-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mail-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  font-size: 14px;
}
.mail-nav-item svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}
.mail-nav-item span:first-of-type { flex: 1; }
.mail-nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.mail-nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.nav-count {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.mail-nav-item.active .nav-count {
  background: rgba(255,255,255,0.3);
}

.mail-quick-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.quick-action-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quick-action-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}
.quick-action-btn svg {
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
}
.quick-action-btn:hover svg {
  fill: var(--primary);
}

/* 中间列表区域 */
.mail-list-panel {
  flex: 1;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc, #fff);
}
.list-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.list-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.list-count {
  font-size: 12px;
  color: var(--text-muted);
}
.list-actions {
  display: flex;
  gap: 8px;
}

.email-list {
  flex: 1;
  overflow-y: auto;
}

.email-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all .15s;
  gap: 12px;
}
.email-item:hover {
  background: var(--bg);
}
.email-item.selected {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}
.email-item.unread {
  background: #fafbff;
}
.email-item.unread .email-from,
.email-item.unread .email-subject {
  font-weight: 600;
}

.email-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.email-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.email-avatar.sent {
  background: linear-gradient(135deg, var(--success), #10b981);
}
.email-info {
  flex: 1;
  min-width: 0;
}
.email-from {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-subject {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.email-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.email-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.email-attachment {
  font-size: 12px;
}
.email-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.email-status.sent {
  background: #ecfdf5;
  color: var(--success);
}
.email-status.failed {
  background: #fef2f2;
  color: var(--danger);
}

/* 右侧预览区 */
.mail-preview-panel {
  width: 420px;
  background: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.preview-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 16px;
}
.preview-empty svg {
  width: 64px;
  height: 64px;
  fill: #e2e8f0;
}
.preview-empty p {
  font-size: 14px;
}

.preview-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.preview-subject {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.close-preview {
  flex-shrink: 0;
}

.preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.preview-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}
.preview-avatar.sent {
  background: linear-gradient(135deg, var(--success), #10b981);
}
.preview-from-info {
  flex: 1;
  min-width: 0;
}
.preview-from-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.preview-from-email {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.preview-actions {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.preview-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.preview-action-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.preview-action-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.preview-action-btn.danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
  color: var(--danger);
}

.preview-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  line-height: 1.8;
  font-size: 14px;
}
.preview-body.text pre {
  white-space: pre-wrap;
  word-break: break-all;
}

/* 通用按钮 */
.icon-btn {
  width: 36px;
  height: 36px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  color: var(--text-muted);
}
.icon-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* 加载和空状态 */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.small {
  width: 16px;
  height: 16px;
  border-width: 2px;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}
.empty-state svg {
  width: 48px;
  height: 48px;
  fill: #e2e8f0;
}
.empty-state p {
  font-size: 14px;
}

/* 写邮件全屏 */
.compose-full {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.compose-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.compose-form {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  max-width: 1190px !important;
}
.compose-form .form-row {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  margin-bottom: 16px !important;
}
.compose-form .form-row label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.compose-form .form-row input,
.compose-form .form-row select,
.compose-form .form-row textarea {
  width: 100% !important;
  pointer-events: auto !important;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: all .15s;
}
.compose-form .form-row input:focus,
.compose-form .form-row select:focus,
.compose-form .form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.compose-form .content-row {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.compose-form .content-row textarea {
  flex: 1;
  resize: none;
  font-family: inherit;
}
.compose-form .form-actions {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* 按钮样式 */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover {
  background: #f1f5f9;
}
.btn-secondary svg,
.settings-form .btn svg {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* 群发提示 */
.batch-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--primary-light);
  border-radius: 8px;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 16px;
}
.batch-tip svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}
.batch-tip code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  margin: 0 2px;
}

/* 客户选择 */
.customer-select-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.customer-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 8px;
}
.customer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.customer-item:hover {
  background: var(--bg);
}
.customer-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.customer-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
}
.customer-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}
.customer-email {
  font-size: 12px;
  color: var(--text-muted);
}
.customer-footer {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}
.warning-text {
  padding: 20px;
  text-align: center;
  color: var(--warning);
}

/* 模板管理 */
.templates-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}
.templates-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.templates-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.templates-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 4px;
}
.template-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all .2s;
}
.template-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}
.template-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.template-icon {
  font-size: 28px;
}
.template-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.template-preview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 6px;
}
.template-actions {
  display: flex;
  gap: 8px;
}
.template-btn {
  flex: 1;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.template-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.template-btn.danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
  color: var(--danger);
}

/* 设置页面 */
.settings-panel {
  height: 100%;
  padding: 20px;
  overflow-y: auto;
}
.settings-header {
  margin-bottom: 20px;
}
.settings-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.settings-form {
  max-width: 1190px;
  width: 100%;
}
.settings-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.settings-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.settings-section h4 svg {
  width: 20px;
  height: 20px;
  fill: var(--primary);
}
.settings-form .form-row-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.settings-form .form-row-group .form-row {
  flex: 1;
  min-width: 200px;
}
.settings-form .form-row-group .form-row.small {
  flex: 0 0 120px;
  min-width: 100px;
}

/* 弹窗 - 兼容模式 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.modal-box form {
  padding: 20px;
  overflow-y: auto;
}
.modal-box .form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all .3s ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-success, .toast.toast-success {
  background: var(--success);
}
.toast-error, .toast.toast-error {
  background: var(--danger);
}
.toast-warning, .toast.toast-warning {
  background: var(--warning);
}

/* 响应式 */
@media (max-width: 1200px) {
  .mail-preview-panel {
    width: 360px;
  }
}
@media (max-width: 1024px) {
  .mail-preview-panel {
    display: none;
  }
  .mail-sidebar {
    width: 160px;
  }
}
@media (max-width: 768px) {
  .mail-sidebar {
    width: 60px;
    padding: 12px 8px;
  }
  .mail-compose-btn span,
  .mail-nav-item span:first-of-type,
  .mail-quick-actions {
    display: none;
  }
  .mail-compose-btn {
    padding: 12px 8px;
  }
  .mail-nav-item {
    justify-content: center;
    padding: 12px;
  }
  .mail-sidebar {
    align-items: center;
  }
  .quick-action-btn {
    padding: 8px;
  }
}





/* 模板编辑器 Quill 样式 */
.modal-box .content-row { display: block !important; margin-bottom: 16px; }
.modal-box .content-row label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.modal-box #templateEditor { display: block !important; height: 300px !important; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.modal-box #templateEditor .ql-container { height: calc(300px - 42px) !important; font-size: 14px; }
.modal-box #templateEditor .ql-editor { min-height: 200px; }
.modal-box #templateEditor .ql-toolbar { border: none; border-bottom: 1px solid var(--border); }
.modal-box #templateEditor .ql-container { border: none; }

/* 设置页面按钮横向排列 */
.settings-form .form-actions {
  display: flex !important;
  gap: 12px !important;
  flex-direction: row !important;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.settings-form .form-actions .btn {
  display: inline-flex !important;
  flex-direction: row !important;
}

/* 代码标签 */
.code-tag {
  font-size: 12px !important;
  background: #f1f5f9 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-family: 'Consolas', monospace !important;
}


/* ===== 小喇叭通知系统 ===== */
.notification-bell {
  position: relative;
}

.bell-btn {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
}

.bell-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--text-muted);
  transition: fill .2s;
}

.bell-btn:hover {
  background: var(--bg);
}

.bell-btn:hover svg {
  fill: var(--text);
}

.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  animation: bellBadgePop .3s ease;
}

/* 闪烁动画 */
@keyframes bellBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.92); }
}

.bell-btn.blink {
  animation: bellBlink 1.5s ease-in-out infinite;
}

.bell-btn.blink svg {
  fill: #ef4444;
}

.bell-btn.blink:hover {
  background: #fef2f2;
}

/* 通知面板 */
.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-height: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

.notification-panel.show {
  display: flex;
  animation: panelSlideIn .2s ease;
}

@keyframes panelSlideIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc, #fff);
}

.notification-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.notification-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-link {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
  transition: all .15s;
}

.btn-link:hover {
  background: var(--primary-light);
}

/* 通知标签页 */
.notification-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-tabs .tab-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}

.notification-tabs .tab-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.notification-tabs .tab-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

/* 通知列表 */
.notification-list {
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
}

.notification-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .15s;
}

.notification-item:hover {
  background: var(--bg);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background: rgba(99, 102, 241, 0.04);
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon.reminder {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #d97706;
}

.notification-icon.message {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #2563eb;
}

.notification-icon.notice {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #059669;
}

.notification-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.notification-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.notification-unread-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  color: var(--text-muted);
  text-align: center;
}

.notification-empty svg {
  width: 48px;
  height: 48px;
  fill: #e2e8f0;
  margin-bottom: 12px;
}

.notification-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

.notification-footer a {
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .15s;
}

.notification-footer a:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.notification-footer .divider {
  color: var(--border);
}

/* 通知设置样式 */
.settings-form .setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.settings-form .setting-item:last-child {
  border-bottom: none;
}

.settings-form .setting-info {
  flex: 1;
}

.settings-form .setting-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.settings-form .setting-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* 开关样式 */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #e2e8f0;
  border-radius: 24px;
  transition: all .2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: all .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* 响应式 */
@media (max-width: 480px) {
  .notification-panel {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - var(--header-h) - 20px);
    border-radius: 0 0 12px 12px;
  }
}
