/* ===== 全局变量 ===== */
:root {
  --primary: #4f6df5;
  --primary-dark: #3b56c7;
  --primary-light: #eef1fe;
  --success: #00b96b;
  --success-light: #e6f9f0;
  --warning: #faad14;
  --warning-light: #fff7e6;
  --danger: #ff4d4f;
  --danger-light: #fff1f0;
  --info: #1890ff;
  --info-light: #e6f4ff;

  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-hover: #f5f7fa;
  --border: #e8e8e8;
  --border-light: #f0f0f0;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;

  --sidebar-width: 200px;
  --topbar-height: 60px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition: all 0.2s ease;
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ===== 登录页 ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-header h1 { font-size: 22px; color: var(--text-primary); margin-bottom: 8px; }
.login-header p { font-size: 13px; color: var(--text-secondary); }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.login-form input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); outline: none; transition: var(--transition);
}
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-hint { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.login-hint p { font-size: 12px; color: var(--text-tertiary); line-height: 1.8; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; font-weight: 500; transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-default { background: #fff; border: 1px solid var(--border); color: var(--text-primary); }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 主布局 ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width); background: #1e293b; color: #cbd5e1;
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; bottom: 0; z-index: 100; transition: var(--transition);
}
.sidebar-header {
  padding: 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo-icon {
  width: 26px; height: 26px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.logo-icon svg {
  width: 22px; height: 22px; stroke: currentColor; fill: none;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.logo-text { font-size: 15px; font-weight: 600; color: #fff; white-space: nowrap; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  color: #94a3b8; transition: var(--transition); border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(79,109,245,0.15); color: #fff; border-left-color: var(--primary); }
.nav-icon {
  width: 24px; height: 20px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-icon svg {
  width: 19px; height: 19px;
  stroke: currentColor; fill: none;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
  opacity: .95;
}
.nav-item:hover .nav-icon svg { opacity: 1; stroke-width: 2.1; }
.nav-item.active .nav-icon { color: var(--primary); }
.nav-item.active .nav-icon svg { opacity: 1; stroke-width: 2.1; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 16px; font-weight: 600;
  flex-shrink: 0;
}
.user-name { font-size: 14px; color: #fff; font-weight: 500; }
.user-role { font-size: 12px; color: #64748b; }
.btn-logout {
  width: 100%; padding: 8px; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1); color: #94a3b8;
  border-radius: var(--radius); cursor: pointer; transition: var(--transition);
  font-size: 13px;
}
.btn-logout:hover { background: rgba(239,68,68,0.15); color: #ef4444; border-color: #ef4444; }
.sidebar-footer .btn-logout + .btn-logout { margin-top: 8px; }

.main-content {
  flex: 1; margin-left: var(--sidebar-width); transition: var(--transition);
  display: flex; flex-direction: column; min-height: 100vh;
}
.top-bar {
  height: var(--topbar-height); background: #fff; display: flex;
  align-items: center; padding: 0 24px; gap: 16px;
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50;
}
.top-bar h2 { font-size: 18px; font-weight: 600; }
.title-wrap { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }
.current-date { font-size: 13px; color: var(--text-secondary); }
.page-content { flex: 1; padding: 24px; overflow-y: auto; }

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px; letter-spacing: 0.2px;
}
.card-header h3::before { content: ''; width: 4px; height: 15px; border-radius: 2px; background: var(--primary); flex-shrink: 0; }
.card-body { padding: 20px; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--info-light); color: var(--info); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-info { flex: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
/* R192：紧凑统计卡（甘特图等少文字场景） */
.stat-card.compact { padding: 10px 16px; gap: 12px; align-items: center; }
.stat-card.compact .stat-icon { width: 34px; height: 34px; border-radius: 9px; font-size: 17px; }
.stat-card.compact .stat-value { font-size: 20px; line-height: 1.2; }
.stat-card.compact .stat-label { margin-bottom: 0; }
.stat-card.compact .stat-sub { margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-light); }
table th { font-size: 13px; color: var(--text-secondary); font-weight: 600; background: #fafafa; white-space: nowrap; }
table td { font-size: 14px; }
table tbody tr:hover { background: var(--bg-hover); }

/* ===== 标签/徽章 ===== */
.tag {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 12px; font-size: 12px; font-weight: 500;
}
.tag-blue { background: var(--info-light); color: var(--info); }
.tag-green { background: var(--success-light); color: var(--success); }
.tag-orange { background: var(--warning-light); color: var(--warning); }
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-gray { background: #f3f4f6; color: #6b7280; }
.tag-purple { background: #f3e8ff; color: #9333ea; }

/* ===== 进度条 ===== */
.progress-bar {
  width: 100%; height: 8px; background: var(--border-light);
  border-radius: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 4px; transition: width 0.3s ease;
  background: var(--primary);
}
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-group label .required { color: var(--danger); }
.form-control {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); outline: none; transition: var(--transition);
  background: #fff;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 600px; max-width: 95vw;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.modal.modal-lg { width: 900px; }
.modal.modal-xl { width: 1060px; }
.modal.modal-sm { width: 400px; }
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--text-tertiary); padding: 4px 8px; border-radius: 4px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius); box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  animation: slideIn 0.3s ease; min-width: 250px; max-width: 400px;
}
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--info); color: #fff; }
.toast.warning { background: var(--warning); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 工具类 ===== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.ml-8 { margin-left: 8px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 600; }
.font-lg { font-size: 18px; }
.font-xl { font-size: 24px; }
.font-sm { font-size: 13px; }
.font-xs { font-size: 12px; }
.w-full { width: 100%; }

/* ===== 项目节点时间线 ===== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 10px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 20px; min-width: 0; }
.timeline-item > div:last-child { min-width: 0; }
.timeline-item .flex.gap-4 { flex-wrap: wrap; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -28px; top: 4px; width: 20px; height: 20px;
  border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--border);
  background: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.timeline-dot.completed { background: var(--success); box-shadow: 0 0 0 2px var(--success); color: #fff; }
.timeline-dot.in_progress { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); color: #fff; }
.timeline-dot.pending { background: #fff; box-shadow: 0 0 0 2px var(--border); }
.timeline-dot.skipped { background: var(--text-tertiary); box-shadow: 0 0 0 2px var(--text-tertiary); }

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 16px; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.filter-bar .form-control { width: auto; min-width: 140px; }
.filter-bar .search-input { flex: 1; min-width: 200px; }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-tertiary);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== 项目卡片列表 ===== */
.project-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.project-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: var(--transition); cursor: pointer;
  border: 1px solid transparent;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); transform: translateY(-2px); }
.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.project-card-header > div:first-child { flex: 1; min-width: 0; }
.project-card-header .tag { flex-shrink: 0; white-space: nowrap; }
.project-card-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-card-code { font-size: 12px; color: var(--text-tertiary); }
.project-card-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; }

/* ===== 月度报表紧凑表格（R54：不超宽、无横向滚动） ===== */
.report-table th, .report-table td { padding: 8px 10px; font-size: 13px; }
.report-table th { white-space: nowrap; }
.report-table td { white-space: nowrap; }
.report-table .cell-ellipsis { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }

/* ===== 周报报告样式 ===== */
.report-section { margin-bottom: 24px; }
.report-section h4 { font-size: 15px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-light); }
.report-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.report-meta { display: flex; gap: 24px; padding: 12px 16px; background: #fafafa; border-radius: var(--radius); margin-bottom: 16px; }
.report-meta-item { font-size: 13px; }
.report-meta-item span { color: var(--text-secondary); }

/* ===== 仪表盘迷你日历 ===== */
.dash-cal-wrap { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dash-cal-wrap { grid-template-columns: 1fr; } }
.dash-cal-head { font-size: 14px; font-weight: 600; text-align: center; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.dash-cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 6px; }
.dash-cal-weekdays span { text-align: center; font-size: 11px; color: var(--text-tertiary); padding: 2px 0; }
.dash-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 4px; }
.dash-cal-cell { position: relative; aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); }
.dash-cal-cell.empty { cursor: default; }
.dash-cal-cell:hover { background: var(--bg-hover); }
.dash-cal-cell.has-ev { background: #f7f9ff; font-weight: 600; }
.dash-cal-cell.today { background: var(--primary-light); box-shadow: inset 0 0 0 1px var(--primary); }
.dash-cal-day { font-size: 12px; line-height: 1; }
.dash-cal-dots { display: flex; gap: 2px; }
.dash-cal-dots i { width: 4px; height: 4px; border-radius: 50%; display: block; }
.dash-cal-foot { display: flex; gap: 18px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-light); font-size: 12px; color: var(--text-secondary); }
.dash-cal-foot b { color: var(--text-primary); }
.dash-cal-side-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.dash-cal-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); }
.dash-cal-item:hover { background: var(--bg-hover); }
.dash-cal-item-title { font-size: 13px; }
.dash-cal-item-sub { font-size: 11px; color: var(--text-secondary); }

/* ===== 日历可收放 ===== */
.dash-cal-inline { margin-left: 10px; font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.dash-cal-inline b { color: var(--primary); font-weight: 600; }
.dash-cal-card.collapsed { padding: 0; }
.dash-cal-card.collapsed .card-header { padding: 10px 16px; border-bottom: none; }
.dash-cal-card.collapsed .card-header h3 { font-size: 14px; }
.cal-collapsed { display: none; }

/* ===== 视图切换（卡片 / 列表）===== */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-body); }
.view-switch-btn { padding: 4px 12px; font-size: 12px; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.view-switch-btn:hover { background: var(--bg-hover); }
.view-switch-btn + .view-switch-btn { border-left: 1px solid var(--border); }
.view-switch-btn.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ===== 统计卡片辅助 ===== */
.cum-range { display: inline-block; margin-left: 6px; padding: 1px 6px; font-size: 11px; font-weight: 500; color: var(--primary-dark); background: var(--primary-light); border-radius: 10px; vertical-align: middle; }
.stat-split { color: var(--text-tertiary); font-weight: 400; margin: 0 2px; }
.stat-unit { margin-left: 4px; font-size: 12px; font-weight: 400; color: var(--text-tertiary); }

/* ===== 月度预测录入（仅本年度后续月份可编辑）===== */
.fc-tip { margin-bottom: 12px; padding: 8px 12px; font-size: 12px; line-height: 1.6; color: var(--primary-dark); background: var(--primary-light); border-radius: 6px; }
.fc-readonly { background: var(--bg-secondary, #f5f6f8); color: var(--text-tertiary); cursor: not-allowed; }
.fc-past { margin-left: 4px; padding: 0 5px; font-size: 10px; color: #fff; background: var(--text-tertiary); border-radius: 8px; vertical-align: middle; }
.fc-row-past { opacity: 0.75; }
.stat-sub { margin-top: 4px; font-size: 11px; color: var(--text-tertiary); }
.row-dim td { color: var(--text-tertiary); }
.text-income { color: var(--success); }
.text-cost { color: var(--danger); }

/* ===== 明细弹窗 ===== */
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; padding: 12px 14px; background: #fafafa; border-radius: var(--radius); }
.detail-meta span { color: var(--text-secondary); font-size: 13px; }
.detail-section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .detail-section-grid { grid-template-columns: 1fr; } .detail-meta { grid-template-columns: 1fr; } }

/* ===== 日历 ===== */
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; font-size: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; cursor: pointer; user-select: none; transition: var(--transition); }
.cal-legend-item:hover { border-color: var(--primary); }
.cal-legend-item.off { opacity: .4; }
.cal-legend-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cal-legend-item b { font-weight: 600; color: var(--text-secondary); }

.cal-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } }

.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-weekday { text-align: center; padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 104px; padding: 4px 5px; border-right: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); cursor: pointer; transition: var(--transition); }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.weekend { background: #f1f3f7; }
/* R164：周末列（星期日/星期六）整列底色加深 */
.cal-weekday:nth-child(1), .cal-weekday:nth-child(7) { background: #e9edf3; }
.cal-weekdays span:nth-child(1), .cal-weekdays span:nth-child(7) { background: #e9edf3; border-radius: 4px; }
.cal-cell-empty { background: #fafafa; cursor: default; }
.cal-cell.today { background: var(--primary-light); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-daynum { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
.cal-today-tag { font-size: 10px; font-weight: 500; color: #fff; background: var(--primary); border-radius: 8px; padding: 0 5px; }
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-ev { display: flex; align-items: center; gap: 3px; padding: 1px 4px; font-size: 11px; line-height: 1.5; background: #f7f8fa; border-left: 3px solid #999; border-radius: 2px; overflow: hidden; }
.cal-ev-icon { flex: 0 0 auto; font-size: 11px; }
.cal-ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: 10px; color: var(--text-tertiary); padding-left: 4px; }

.cal-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cal-summary > div { padding: 10px; background: #fafafa; border-radius: var(--radius); }
.cal-summary span { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.cal-summary strong { font-size: 15px; color: var(--text-primary); }

.cal-list { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow-y: auto; }
.cal-list-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); }
.cal-list-item:hover { background: var(--bg-hover); }
.cal-list-item.static { cursor: default; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.cal-list-main { min-width: 0; }
.cal-list-title { font-size: 13px; font-weight: 500; }
.cal-list-sub { font-size: 11px; color: var(--text-secondary); }
.cal-list-desc { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { width: 140px; }
  .sidebar-header, .sidebar-footer { padding: 12px; }
  .nav-item { padding: 10px 12px; gap: 8px; }
  .logo-text { font-size: 13px; }
  .main-content { margin-left: 140px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .project-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 80px; }
}

/* ===== 开票回款台账（财务报表子模块）===== */
.ledger-flow {
  display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap;
  padding: 14px; background: #fafbfc; border: 1px solid var(--border-light); border-radius: var(--radius);
}
.ledger-flow-item { flex: 1; min-width: 150px; }
.ledger-flow-item > span { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.ledger-flow-item > b { display: block; font-size: 18px; font-weight: 700; color: var(--text-primary); }
.ledger-flow-arrow { display: flex; align-items: center; color: var(--text-tertiary); font-size: 18px; }
.ledger-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.ledger-bar { width: 100%; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--border-light); overflow: hidden; }
.ledger-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--border); }
.ledger-bar.part i { background: var(--warning); }
.ledger-bar.full i { background: var(--success); }
.ledger-bar.none i { background: var(--border); }

.ledger-card-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 4px; }
.ledger-card-nums span { display: block; font-size: 11px; color: var(--text-secondary); }
.ledger-card-nums b { font-size: 13px; }
.ledger-card-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-tertiary); margin-top: 6px; }

.ledger-table { width: 100%; border-collapse: collapse; }
.ledger-table th { background: #fafafa; font-size: 12px; white-space: nowrap; padding: 10px 14px; }
.ledger-table td { border-bottom: 1px solid var(--border-light); padding: 10px 14px; font-size: 13px; }
.ledger-table tr.ledger-inv:hover { background: var(--bg-hover); }
.ledger-table tr.ledger-pay { background: #fafbfc; }
.ledger-table tr.ledger-pay td { padding: 6px 8px; border-bottom: 1px dashed var(--border-light); }
.ledger-table tr.ledger-pay:hover { background: #f4f7ff; }
.ledger-tree { color: var(--text-tertiary); white-space: nowrap; }
.ledger-ops { white-space: nowrap; text-align: right; }
.ledger-ops .btn { margin-right: 4px; }
.ledger-ops .btn:last-child { margin-right: 0; }
.ledger-table tr.ledger-group td {
  padding: 8px; font-size: 12px; font-weight: 600; color: var(--text-secondary); background: #f5f6f8;
}
.ledger-table tr.ledger-total td {
  padding: 10px 8px; font-weight: 700; background: var(--primary-light); border-bottom: none;
}

/* 回款确认信息框 */
.pay-confirm-box {
  padding: 12px 14px; margin-bottom: 16px; background: #fafbfc;
  border: 1px solid var(--border-light); border-radius: var(--radius);
}
.pay-confirm-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.pay-confirm-row span { color: var(--text-secondary); }
.pay-confirm-row b { color: var(--text-primary); }

/* ===== 仪表盘内置日历（原独立日历页已并入）===== */
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-bar .cal-title { font-size: 16px; font-weight: 600; margin-left: 8px; color: var(--text-primary); }

/* ===== 周报：本周主要动态 ===== */
.hl-overall { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 10px 14px; background: #fafbfc; border: 1px solid var(--border-light); border-radius: var(--radius); }
.hl-overall-text { font-size: 13px; white-space: nowrap; }
.hl-overall-text b { font-size: 18px; color: var(--primary); }
.hl-overall .ledger-bar { margin-top: 0; flex: 1; }

.hl-group { padding: 12px 0; border-top: 1px dashed var(--border-light); }
.hl-group:first-of-type { border-top: none; }
.hl-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hl-group-rate { display: flex; align-items: center; gap: 8px; }
.hl-list { display: flex; flex-direction: column; gap: 6px; }
.hl-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-sm); }
.hl-item:hover { border-color: var(--primary-light); background: #fcfdff; }
.hl-cat { flex: 0 0 auto; padding: 1px 8px; font-size: 11px; border: 1px solid; border-radius: 10px; }
.hl-title { flex: 1; font-size: 13px; }
.hl-owner { flex: 0 0 auto; font-size: 11px; color: var(--text-secondary); }
.hl-status-select { flex: 0 0 auto; padding: 1px 6px; font-size: 11px; border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.hl-status-select.tag-green { color: var(--success); border-color: var(--success); }
.hl-status-select.tag-orange { color: var(--warning); border-color: var(--warning); }
.hl-status-select.tag-red { color: var(--danger); border-color: var(--danger); }
.hl-status-select.tag-gray { color: #6b7280; border-color: #d1d5db; }

/* ===== 甘特图 ===== */
.gantt-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; font-size: 12px; color: var(--text-secondary); }
.gantt-legend span { display: inline-flex; align-items: center; gap: 4px; }
.gantt-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.gantt-scroll { overflow-x: auto; }
.gantt { min-width: 960px; }
.gantt-head, .gantt-row { display: grid; grid-template-columns: 240px 1fr 90px; align-items: center; }
.gantt-head { padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.gantt-head-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding-left: 4px; }
.gantt-head-status { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-align: right; padding-right: 4px; }
.gantt-head-track { display: flex; height: 20px; }
.gantt-scale-cell { flex: 0 0 auto; font-size: 11px; color: var(--text-secondary); text-align: center; border-left: 1px solid var(--border-light); line-height: 20px; overflow: hidden; white-space: nowrap; }
.gantt-scale-cell:first-child { border-left: none; }

.gantt-row { padding: 5px 0; border-bottom: 1px solid var(--border-light); }
.gantt-row:hover { background: #fcfdff; }
.gantt-label { padding-right: 12px; min-width: 0; }
.gantt-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-sub { display: flex; gap: 8px; font-size: 11px; color: var(--text-tertiary); }
.gantt-track {
  position: relative; height: 30px; border-radius: 4px; background: #fafbfc;
  background-image: linear-gradient(to right, var(--border-light) 1px, transparent 1px);
}
.gantt-bar {
  position: absolute; top: 8px; height: 14px; min-width: 4px; border-radius: 7px;
  background: var(--border-light); overflow: hidden; cursor: pointer;
}
.gantt-bar-fill { height: 100%; border-radius: 7px; transition: width .3s; }
.gantt-bar-text { position: absolute; right: 4px; top: -1px; font-size: 10px; color: var(--text-secondary); }
.gantt-node {
  position: absolute; top: 11px; width: 9px; height: 9px; margin-left: -4px;
  background: #cbd5e1; transform: rotate(45deg); border: 1px solid #fff; border-radius: 2px; cursor: pointer;
}
.gantt-node.done { box-shadow: 0 0 0 1px rgba(16,185,129,.4); }
/* R95：已完成节点连线（实线）；未完成区段自然留白 */
.gantt-node-line {
  position: absolute; top: 14px; height: 2px; margin-left: -4px;
  background: #10b981; opacity: .55; z-index: 1; pointer-events: none;
}
.gantt-node { z-index: 2; }
.gantt-node:hover { transform: rotate(45deg) scale(1.4); z-index: 3; }
.gantt-end { position: absolute; top: 24px; font-size: 10px; color: var(--text-tertiary); transform: translateX(-50%); white-space: nowrap; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; opacity: .7; z-index: 2; }
.gantt-today::after { content: '今天'; position: absolute; top: -1px; left: 3px; font-size: 10px; color: #ef4444; white-space: nowrap; }
.gantt-status { text-align: right; }
.gantt-status .tag { padding: 1px 8px; font-size: 11px; }

/* ===== 人员 × 项目分配 ===== */
.assign-tip {
  padding: 8px 12px; margin-bottom: 12px; font-size: 12px; color: var(--text-secondary);
  background: #fafbfc; border: 1px solid var(--border-light); border-radius: var(--radius);
}
.assign-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.assign-col { min-width: 0; }
.assign-col-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 8px; margin-bottom: 8px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border-light);
}
.assign-ops { display: flex; gap: 6px; }
.assign-scroll { max-height: 420px; overflow-y: auto; }
.assign-user {
  padding: 8px 10px; margin-bottom: 6px; cursor: pointer;
  border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: #fff;
}
.assign-user:hover { border-color: var(--primary-light); background: #fcfdff; }
.assign-user.active { border-color: var(--primary); background: var(--primary-light); }
.assign-user-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.assign-proj {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-bottom: 1px dashed var(--border-light); cursor: pointer; font-size: 13px;
}
.assign-proj:hover { background: #fafbfc; }
.assign-proj.sub { padding-left: 24px; color: var(--text-secondary); }
.assign-proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* R171：月度预测编辑器——当月实际/下月预计着色 */
.fc-cur-input { border-color: var(--success); background: #f2fbf6; }
.fc-cur-input:focus { border-color: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.15); }
