/* ===== CSS 变量 ===== */
:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-hover: #f5f5f5;
  --bg-sidebar: #ffffff;
  --bg-overlay: rgba(0,0,0,0.4);
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-bg: rgba(99,102,241,0.08);
  --success: #10b981;
  --success-bg: rgba(16,185,129,0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.1);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --transition: all 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-hover: #1e293b;
  --bg-sidebar: #16213e;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border: #334155;
  --border-light: #1e293b;
  --primary-light: #312e81;
  --primary-bg: rgba(99,102,241,0.15);
  --success-bg: rgba(16,185,129,0.15);
  --warning-bg: rgba(245,158,11,0.15);
  --danger-bg: rgba(239,68,68,0.15);
  --info-bg: rgba(59,130,246,0.15);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.3);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul { list-style: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ===== 布局 ===== */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-logo {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
}
.sidebar-title { font-weight: 600; font-size: 15px; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--primary); border-radius: 0 3px 3px 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.nav-item.parent-active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.nav-submenu {
  margin-left: 24px;
  padding: 4px 0;
  border-left: 1px solid var(--border-light);
}
.nav-subitem {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 1px;
}
.nav-subitem:hover { background: var(--bg-hover); color: var(--text); }
.nav-subitem.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.nav-submenu-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); cursor: pointer; padding: 4px; color: var(--text-tertiary); font-size: 10px; z-index: 5; transition: var(--transition); }
.nav-submenu-toggle:hover { color: var(--primary); }
.nav-item:has(+ .nav-submenu-toggle + .nav-submenu) { padding-right: 30px; }
.nav-icon { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-light);
}
.theme-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  width: 100%;
  transition: var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 0 8px;
  cursor: pointer;
  transition: var(--transition);
}
.user-card:hover { background: var(--bg-hover); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-tertiary); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.page-title { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ===== 通用组件 ===== */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 32px;
  position: relative;
  overflow: hidden;
}
.btn::after { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; background: rgba(255,255,255,0.2); border-radius: 50%; transform: translate(-50%, -50%); transition: width 0.3s, height 0.3s; }
.btn:active::after { width: 200px; height: 200px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-hover); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gray { background: var(--bg-hover); color: var(--text-secondary); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--border-light);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 16px; }

.input, .textarea, .select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  transition: var(--transition);
  min-height: 36px;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.textarea { resize: vertical; min-height: 80px; }
.label { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { color: var(--text-tertiary); font-size: 22px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== 登录页 ===== */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: dotMove 20s linear infinite;
  pointer-events: none;
}
@keyframes dotMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}
.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.2);
  width: 420px;
  max-width: 92%;
  padding: 48px 40px;
  animation: slideUp 0.4s ease-out;
  position: relative;
  z-index: 1;
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 28px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 20px rgba(99,102,241,0.3);
}
.login-title { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 6px; letter-spacing: 0.5px; }
.login-subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }
.login-form-group { margin-bottom: 20px; }
.login-form-group .label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; display: block; }
.login-input-wrap { position: relative; }
.login-input-wrap .input { padding-left: 40px; min-height: 44px; font-size: 15px; border-radius: var(--radius); transition: all 0.2s; }
.login-input-wrap .input:focus { box-shadow: 0 0 0 4px var(--primary-bg); }
.login-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); font-size: 16px; pointer-events: none; }
.login-btn { width: 100%; padding: 14px; font-size: 16px; font-weight: 600; border-radius: var(--radius); margin-top: 8px; box-shadow: 0 4px 12px rgba(99,102,241,0.3); transition: all 0.2s; }
.login-btn:hover { box-shadow: 0 6px 20px rgba(99,102,241,0.4); transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }
.login-error-box { margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); font-size: 13px; text-align: center; border: 1px solid rgba(239,68,68,0.2); }
.login-accounts { background: var(--bg-hover); border-radius: var(--radius); padding: 14px; margin-top: 20px; border: 1px solid var(--border-light); }
.login-accounts summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); font-weight: 500; list-style: none; display: flex; align-items: center; gap: 6px; }
.login-accounts summary::before { content: '▶'; font-size: 10px; transition: transform 0.2s; }
.login-accounts details[open] summary::before { transform: rotate(90deg); }
.login-account-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-light); }
.login-account-item:last-child { border-bottom: none; }
.login-account-role { font-weight: 600; color: var(--primary); min-width: 70px; }
.login-account-cred { color: var(--text-tertiary); }
.login-warning { margin-top: 10px; color: var(--danger); font-size: 11px; text-align: center; }

/* ===== 仪表盘 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}
.stat-icon.blue { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }
.stat-icon.green { background: linear-gradient(135deg, #11998e, #38ef7d); color: white; }
.stat-icon.orange { background: linear-gradient(135deg, #f093fb, #f5576c); color: white; }
.stat-icon.purple { background: linear-gradient(135deg, #4facfe, #00f2fe); color: white; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.compact { font-size: 18px; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-label.compact { font-size: 12px; margin-top: 0; }
.stat-subtitle { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.stat-card.compact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 0;
}
.stat-card.compact .stat-icon {
  width: 36px; height: 36px;
  font-size: 16px;
  margin-bottom: 0;
}
.stats-grid.compact { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.chart-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.chart-bar-label { width: 80px; font-size: 12px; color: var(--text-secondary); text-align: right; }
.chart-bar-track { flex: 1; height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.chart-bar-value { width: 32px; font-size: 12px; font-weight: 600; }

.donut-container { display: flex; align-items: center; gap: 20px; }
.donut-chart { width: 120px; height: 120px; flex-shrink: 0; }
.donut-legend { flex: 1; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 6px; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ===== 项目列表 ===== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.project-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border-left: 3px solid var(--primary);
  cursor: pointer;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
}
.project-name { font-weight: 600; font-size: 15px; }
.project-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-meta { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.project-progress { margin-top: 12px; }
.progress-bar { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.project-dates { display: flex; align-items: center; gap: 4px; }
.avatars { display: flex; }
.avatars .avatar { width: 24px; height: 24px; font-size: 10px; margin-left: -6px; border: 2px solid var(--bg-card); }
.avatars .avatar:first-child { margin-left: 0; }

/* ===== 看板 ===== */
.kanban-board {
  display: flex;
  gap: 16px;
  height: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-column {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--bg-hover);
  border-radius: var(--radius);
  padding: 12px;
  max-height: calc(100vh - 200px);
}
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 4px 4px 8px;
}
.kanban-column-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kanban-column-count { background: var(--border); color: var(--text-secondary); padding: 1px 8px; border-radius: 20px; font-size: 11px; }
.kanban-cards { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kanban-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: var(--transition);
  border: 1px solid var(--border-light);
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card.card-blocked {
  opacity: 0.7;
  filter: grayscale(0.4);
  border-left: 3px solid var(--warning, #f59e0b);
}
.kanban-card.card-blocked::after {
  content: "\u26D4 \u524D\u7F6E\u672A\u5B8C\u6210";
  display: block;
  font-size: 10px;
  color: var(--warning, #f59e0b);
  margin-top: 4px;
  font-weight: 500;
}
.kanban-card-title { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.kanban-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.kanban-card-assignee { display: flex; align-items: center; gap: 4px; }
.kanban-card-assignee .avatar { width: 20px; height: 20px; font-size: 9px; }
.kanban-card-due { color: var(--text-tertiary); }
.kanban-card-due.overdue { color: var(--danger); }
.kanban-column.drag-over { background: var(--primary-bg); }

/* ===== 甘特图 ===== */
.gantt-container { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.gantt-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.gantt-legend { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.gantt-legend-item { display: flex; align-items: center; gap: 4px; }
.gantt-legend-dot { width: 12px; height: 8px; border-radius: 2px; }
.gantt-scroll { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 240px); }
.gantt-grid { display: grid; position: relative; min-width: 800px; }
.gantt-header-row { display: flex; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; background: var(--bg-card); }
.gantt-header-cell {
  flex: 1;
  min-width: 40px;
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 6px 0;
  border-right: 1px solid var(--border-light);
}
.gantt-header-cell.weekend { background: var(--border-light); }
.gantt-header-month {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.gantt-row { display: flex; align-items: center; min-height: 40px; border-bottom: 1px solid var(--border-light); position: relative; }
.gantt-row:hover { background: var(--bg-hover); }
.gantt-label {
  width: 200px;
  min-width: 200px;
  padding: 6px 12px;
  font-size: 12px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 5;
}
.gantt-label.project-label { font-weight: 600; background: var(--bg-hover); }
.gantt-label.task-label { padding-left: 28px; color: var(--text-secondary); }
.gantt-bar-area { flex: 1; position: relative; height: 40px; }
.gantt-bar {
  position: absolute;
  top: 8px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 10px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.gantt-bar:hover { filter: brightness(1.1); }
.gantt-bar-progress { position: absolute; bottom: 0; left: 0; height: 3px; background: rgba(255,255,255,0.4); border-radius: 0 0 0 var(--radius-sm); }
.gantt-milestone {
  position: absolute;
  top: 10px;
  width: 16px; height: 16px;
  transform: rotate(45deg);
  background: var(--danger);
  margin-left: -8px;
}
.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--danger);
  opacity: 0.5;
  z-index: 3;
}

/* ===== 成员页 ===== */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.member-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  text-align: center;
}
.member-card:hover { box-shadow: var(--shadow-md); }
.member-avatar { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 20px; margin: 0 auto 12px; }
.member-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.member-title { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.member-info { display: flex; justify-content: center; gap: 16px; font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.member-info span { display: flex; align-items: center; gap: 4px; }
.member-stats { display: flex; justify-content: space-around; padding-top: 12px; border-top: 1px solid var(--border-light); }
.member-stat-value { font-size: 18px; font-weight: 700; }
.member-stat-label { font-size: 11px; color: var(--text-tertiary); }

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-tertiary); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }

/* ===== 下拉菜单 ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}
.dropdown-item { padding: 8px 16px; font-size: 13px; cursor: pointer; transition: var(--transition); }
.dropdown-item:hover { background: var(--bg-hover); }

/* ===== 筛选栏 ===== */
.filter-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  /* v96: 移除阴影，改用边框保持扁平 */
  box-shadow: none;
  border: 1px solid var(--border);
}
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-item { min-width: 140px; flex: 1; }
.filter-item .input, .filter-item .select { height: 34px; }
.filter-summary { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.filter-summary strong { color: var(--primary); }

/* ===== 数据表格 ===== */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  /* v96: 移除阴影，保持扁平 */
  box-shadow: none;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 240px);
  border: 1px solid var(--border);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.data-table thead { background: var(--bg-hover); }
.data-table thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 10;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
  transform: translateZ(0);
  will-change: transform;
  background: var(--bg-hover);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.data-table tbody tr:hover { background: var(--primary-bg); }
.data-table tbody tr.summary-row {
  background: var(--bg-hover);
  font-weight: 600;
  border-top: 2px solid var(--primary);
}
.data-table tbody tr.summary-row td {
  color: var(--primary);
  font-size: 13px;
}
.data-table td {
  padding: 6px 10px;
  vertical-align: middle;
  border: 1px solid var(--border);
}
.data-table td .badge { font-size: 11px; }

/* 表格横向滚动容器（桌面端同样支持），sticky 冻结列依赖它产生滚动 */
.table-responsive {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* 冻结表头+列的表格：容器内双轴滚动，让表头（top）与左/右列（left/right）的
   sticky 相对同一滚动容器生效（overflow-x 会拦截父级垂直 sticky，必须自身纵向滚动） */
.table-responsive.table-frozen {
  overflow-y: auto;
  max-height: calc(100vh - 230px);
}

/* ===== 冻结列：第一列(复选框/空白)、序号、名称左固定 =====
   left 偏移量：第1列 0px，第2列 36px，第3列 86px */
.data-table th.sticky-left,
.data-table td.sticky-left {
  position: -webkit-sticky;
  position: sticky;
  z-index: 4;
  background: var(--bg-card);
  border-right: 1px solid var(--border);   /* 细实线分割 */
  transform: translateZ(0);
  will-change: transform;
}

.data-table thead th.sticky-left {
  z-index: 11;
  background: var(--bg-hover);
  border-right: 1px solid var(--border);
}

.data-table tbody tr:hover td.sticky-left {
  background: var(--bg-hover);
}

/* ===== 冻结列：操作列右固定 ===== */
.data-table th.sticky-right,
.data-table td.sticky-right {
  position: -webkit-sticky;
  position: sticky;
  right: 0;
  z-index: 4;
  background: var(--bg-card);
  /* v96: 移除阴影，改用实线边框保持扁平风格 */
  box-shadow: none;
  border-left: 1px solid var(--border);
  white-space: nowrap; /* 操作按钮不换行 */
}
.data-table thead th.sticky-right {
  z-index: 5;
  background: var(--bg-hover);
}
.data-table tbody tr:hover td.sticky-right {
  background: var(--bg-hover);
}

.cell-ellipsis {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 详情弹窗样式 ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item.full { grid-column: 1 / -1; }
.detail-label { font-size: 11px; color: var(--text-tertiary); }
.detail-value { font-size: 14px; color: var(--text); }
.detail-value.amount { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--primary); }
.detail-value.amount-warn { color: var(--danger); }
.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

/* ===== 表单分区标题 ===== */
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

/* ===== 报销详情特有样式 ===== */
.detail-section { margin-bottom: 20px; }
.detail-section > h4 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.detail-items-table { margin-bottom: 8px; }
.detail-items-table th, .detail-items-table td { padding: 6px 10px; font-size: 13px; }
.approval-history { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; gap: 12px; padding: 8px 12px; background: var(--bg-hover); border-radius: var(--radius-sm); border-left: 3px solid var(--primary); }
.history-step { font-size: 11px; color: var(--text-tertiary); font-weight: 500; min-width: 80px; text-transform: uppercase; }
.history-info { flex: 1; }
.history-remark { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.history-time { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.attachments-list { display: flex; flex-direction: column; gap: 6px; }
.attachment-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-hover); border-radius: var(--radius-sm); }
.attachment-name { font-size: 13px; flex: 1; }
.attachment-size { font-size: 11px; color: var(--text-tertiary); }

/* 报销明细录入表格 */
.item-table { margin-bottom: 8px; }
.item-table th { padding: 6px 8px; font-size: 12px; }
.item-table td { padding: 4px 8px; }
.item-table .select, .item-table .input { font-size: 13px; padding: 4px 8px; min-height: 32px; }

/* ===== 响应式：手机保持桌面布局，仅做滚动与缩放适配 ===== */
@media (max-width: 768px) {
  /* 手机端保持完整桌面布局，关键区域支持滚动 */
  .layout { display: flex; height: 100vh; overflow: hidden; min-width: 900px; }
  .sidebar { width: 220px; flex-shrink: 0; overflow-y: auto; }
  .main { flex: 1; min-width: 0; overflow: hidden; }
  .content { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }

  /* 顶部栏缩小高度，但完整显示 */
  .topbar { height: 48px; padding: 0 12px; }

  /* 登录页居中适配 */
  .login-page { padding: 16px; }
  .login-card { width: 92%; max-width: 400px; }
  .login-logo { width: 40px; height: 40px; font-size: 18px; }
  .login-title { font-size: 18px; }

  /* 输入框防 iOS 缩放 */
  .input, .select, .textarea { font-size: 16px; }

  /* 触摸优化 */
  .btn { min-height: 44px; }

  /* 表格容器惯性滚动 */
  .table-container { -webkit-overflow-scrolling: touch; }

  /* 弹窗适配 */
  .modal {
    max-width: 95vw;
    max-height: 90vh;
  }

  /* 统计卡片单列（空间不够时） */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Toast 顶部居中 */
  .toast { top: 10px; left: 12px; right: 12px; max-width: none; text-align: center; }
}

/* ===== 暗色模式增强 ===== */
[data-theme="dark"] .modal {
  background: #1e293b;
  border: 1px solid #334155;
}
[data-theme="dark"] .modal-header {
  border-bottom-color: #334155;
}
[data-theme="dark"] .modal-footer {
  border-top-color: #334155;
}
[data-theme="dark"] .modal-body {
  background: #1e293b;
}
[data-theme="dark"] .data-table thead th {
  background: #0f172a;
  color: #cbd5e1;
}
[data-theme="dark"] .data-table tbody tr {
  border-bottom-color: #334155;
}
[data-theme="dark"] .data-table td {
  border-color: #334155;
}
[data-theme="dark"] .data-table tbody tr:hover {
  background: rgba(99,102,241,0.12);
}
[data-theme="dark"] .input,
[data-theme="dark"] .select,
[data-theme="dark"] .textarea {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
[data-theme="dark"] .input:focus,
[data-theme="dark"] .select:focus,
[data-theme="dark"] .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
[data-theme="dark"] .login-card {
  background: rgba(30,41,59,0.95);
  color: #f1f5f9;
}
[data-theme="dark"] .login-card .input {
  background: rgba(15,23,42,0.8);
  border-color: #334155;
  color: #e2e8f0;
}
[data-theme="dark"] .stat-card {
  background: #1e293b;
  border: 1px solid #334155;
}
[data-theme="dark"] .table-container {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .filter-bar {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .detail-items-table th {
  background: #0f172a;
  color: #cbd5e1;
  border-color: #334155;
}
[data-theme="dark"] .detail-items-table td {
  border-color: #334155;
}
[data-theme="dark"] .item-table th {
  background: #0f172a;
  color: #cbd5e1;
  border-color: #334155;
}
[data-theme="dark"] .item-table td {
  border-color: #334155;
}
[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .dropdown-item:hover {
  background: rgba(99,102,241,0.15);
}

/* ===== 打印样式 ===== */
@media print {
  .sidebar,
  .topbar,
  .sidebar-search,
  .sidebar-footer,
  .user-card,
  .filter-bar,
  .action-bar,
  .btn,
  .modal-overlay,
  .dropdown,
  .pagination,
  .nav-submenu-toggle,
  #notifBadge,
  #searchDropdown,
  #globalSearchInput,
  #userDropdownMenu {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .data-table,
  .detail-items-table,
  .item-table {
    width: 100% !important;
    font-size: 12px !important;
    border-collapse: collapse !important;
  }
  .data-table th,
  .data-table td,
  .detail-items-table th,
  .detail-items-table td,
  .item-table th,
  .item-table td {
    border: 1px solid #999 !important;
    padding: 4px 8px !important;
    color: #000 !important;
    background: #fff !important;
  }
  .data-table th,
  .detail-items-table th,
  .item-table th {
    background: #f0f0f0 !important;
    font-weight: 600 !important;
  }
  .card,
  .card-body,
  .table-container {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
  .page-break {
    page-break-before: always;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12px !important;
  }
  h1, h2, h3, h4 {
    color: #000 !important;
  }
  a {
    color: #000 !important;
    text-decoration: none !important;
  }
  .status-badge {
    border: 1px solid #999 !important;
    background: #fff !important;
    color: #000 !important;
  }
  .print-only {
    display: block !important;
  }
}
.print-only {
  display: none;
}
