/* ============================================================
   北柠公司项目管理系统 - 样式文件
   ============================================================ */

:root {
  /* 主题：雾霭灰绿（方案B·低亮度） */
  --primary: #4E7268;          /* 主色 灰绿 */
  --primary-light: #628A7E;   /* 主色·亮 */
  --primary-lighter: #E3EAE7;  /* 主色·极淡（表头/选中底） */
  --success: #4E7268;
  --success-bg: #E3EAE7;
  --warning: #7C5C22;
  --warning-bg: #F2ECDD;
  --danger: #96485C;
  --danger-bg: #F2E2E6;
  --gray-50: #F6F8F7;         /* 页面背景 淡灰绿 */
  --gray-100: #EEF2F0;
  --gray-200: #DCE4E0;        /* 边框 淡灰绿 */
  --gray-500: #6A817A;        /* 辅助文字 */
  --gray-700: #354740;        /* 次级文字 */
  --gray-900: #24332C;        /* 主文字 */
  --white: #FFFFFF;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --radius: 14px;             /* 大圆角 */
  --sidebar-width: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; font-size: 14px; color: var(--gray-900); background: var(--gray-50); height: 100vh; overflow: hidden; }

/* Topbar */
.topbar { display: flex; justify-content: space-between; align-items: center; height: 52px; padding: 0 20px; background: var(--primary); color: var(--white); position: fixed; top: 0; left: 0; right: 0; z-index: 100; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 18px; font-weight: bold; }
.role-select { padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.15); color: white; font-size: 13px; cursor: pointer; }
.role-select option { color: #333; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.notification, .user-avatar { font-size: 18px; cursor: pointer; position: relative; }

/* 消息通知铃铛 */
.notif-badge {
  position: absolute; top: -7px; right: -9px; min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px; border-radius: 8px; background: #E53935; color: #fff; font-size: 11px; font-weight: 700;
  text-align: center; box-shadow: 0 0 0 2px var(--primary);
}
.notif-panel {
  position: fixed; top: 52px; right: 14px; width: 340px; max-height: 70vh; overflow-y: auto;
  background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 200; padding: 8px 0; color: var(--gray-900); border: 1px solid var(--gray-200);
}
.notif-section-title { font-size: 12px; font-weight: 700; color: var(--gray-500); padding: 10px 14px 6px; display: flex; align-items: center; gap: 6px; }
.notif-count { background: var(--gray-100); color: var(--gray-700); border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.notif-item { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--gray-100); transition: background .15s; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-50); }
.notif-type { font-size: 12px; color: var(--gray-500); font-weight: 600; }
.notif-title { font-size: 13px; color: var(--gray-900); margin-top: 3px; font-weight: 500; }
.notif-empty { padding: 12px 14px; font-size: 12px; color: var(--gray-500); }

/* Layout */
.app-container { display: flex; margin-top: 52px; height: calc(100vh - 52px); }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: linear-gradient(180deg, #33544C, #456B61); border-right: 1px solid var(--gray-200); overflow-y: auto; padding: 8px 0; flex-shrink: 0; }
.nav-section { padding: 12px 16px 4px; font-size: 11px; color: rgba(255,255,255,0.72); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 9px 16px; color: rgba(255,255,255,0.85); text-decoration: none; font-size: 13px; transition: all 0.15s; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,0.16); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.24); color: #fff; border-left-color: #fff; font-weight: 600; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; }

/* Main Content */
.main-content { flex: 1; overflow-y: auto; padding: 24px; padding-bottom: 48px; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100); }
.card-title { font-size: 16px; font-weight: 600; color: var(--primary); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-sub { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.success .stat-value { color: var(--success); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--primary-lighter); color: var(--primary); font-weight: 600; padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 2px solid var(--primary-light); }
td { padding: 9px 12px; border-bottom: 1px solid var(--gray-100); }
tr:hover { background: var(--gray-50); }

/* ===== 表格版式优化（方案B）===== */
/* 姓名等短列：不折行 */
.cell-name { white-space: nowrap; }
.cell-nowrap { white-space: nowrap; }
/* 数字列：右对齐 + 等宽数字 */
.cell-num { text-align: right; font-variant-numeric: tabular-nums; }
/* 长文本列：保留手动换行、限行、悬停看全文 */
.cell-text { line-height: 1.55; word-break: break-word; }
.cell-clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: 100%; }
.cell-clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cell-clamp4 { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cell-pre { white-space: pre-line; }
/* 固定布局表格：配合 <colgroup> 精确分配列宽 */
table.tbl-fixed { table-layout: fixed; min-width: 920px; }
table.tbl-fixed td { vertical-align: top; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.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(--primary-lighter); color: var(--primary); }
.badge-secondary { background: var(--gray-100); color: var(--gray-700); }

/* Buttons */
.btn { padding: 8px 16px; border-radius: 6px; border: none; font-size: 13px; cursor: pointer; font-weight: 500; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: var(--white); color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-lighter); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-group { display: flex; gap: 8px; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 16px; }
.tab { padding: 10px 20px; cursor: pointer; font-size: 13px; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 13px; font-family: inherit; }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* Filters */
.filters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { padding: 7px 12px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 13px; }

/* Search */
.search-box { position: relative; }
.search-box input { padding-left: 32px; width: 240px; }
.search-box::before { content: '🔍'; position: absolute; left: 10px; top: 7px; font-size: 13px; }

/* Page header */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-header p { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* Progress bar */
.progress-bar { height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--primary-light); }
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 24px; width: 90%; max-width: 600px; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-500); }

/* Dashboard specific */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dashboard-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* 报表中心入口卡片网格：桌面 4 列，窄屏自动降为 2 列，避免卡片被挤到首屏之外 */
.report-entries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.report-entries .card { padding: 16px 12px; }
.report-entries .card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }

/* Performance table */
.perf-table th { position: sticky; top: 0; z-index: 1; }
.perf-table td input { width: 80px; padding: 4px 6px; border: 1px solid var(--gray-200); border-radius: 4px; font-size: 12px; text-align: right; }
.perf-table .total-row { font-weight: 700; background: var(--primary-lighter); }

/* Hamburger menu button */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}
.hamburger:hover { background: rgba(255,255,255,0.15); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

/* Back-to-home button */
.back-home-btn {
  display: none;
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.back-home-btn:hover { background: var(--gray-100); }

/* Responsive */
@media (max-width: 768px) {
  /* Show hamburger */
  .hamburger { display: inline-block; }

  /* Sidebar becomes off-canvas overlay */
  .sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    z-index: 95;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }

  /* Main content full width */
  .main-content { padding: 12px; }

  /* Show back-home button on page headers */
  .back-home-btn { display: inline-flex; align-items: center; gap: 4px; }

  /* Grids single column */
  .dashboard-grid, .dashboard-grid-3 { grid-template-columns: 1fr; }

  /* 报表中心入口卡片：窄屏保留 2 列，避免 8 张卡片纵向堆叠把「后台操作记录」挤出可视区 */
  .report-entries { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .report-entries .card { padding: 14px 10px; }
  .report-entries .card > div:nth-child(2) { font-size: 13px !important; }

  /* Tables scrollable */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Form rows stack */
  .form-row { flex-direction: column; }
  .form-row > * { width: 100% !important; }
}

/* Tablet: 报表入口卡片降为 3 列，保持紧凑 */
@media (min-width: 769px) and (max-width: 1200px) {
  .report-entries { grid-template-columns: repeat(3, 1fr); }
}

/* Site footer (ICP备案) */
.site-footer {
  text-align: center;
  padding: 10px 16px;
  font-size: 12px;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 10;
}
.site-footer a {
  color: var(--gray-500);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--primary);
}

@media (max-width: 768px) {
  .site-footer { left: 0; }
}

/* User menu dropdown */
.user-info { padding: 6px 12px; border-radius: 6px; font-size: 14px; color: #fff; background: rgba(255,255,255,0.15); transition: background 0.2s; cursor: pointer; }
.user-info:hover { background: rgba(255,255,255,0.3); }
.dropdown-menu { position: absolute; top: 48px; right: 60px; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-md); min-width: 150px; z-index: 100; }
.dropdown-item { padding: 10px 16px; cursor: pointer; font-size: 14px; color: var(--gray-700); transition: background 0.15s; }
.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.dropdown-item:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* Modal Card (unified) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-card { background: var(--white); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.3); width: 90%; max-width: 480px; max-height: 85vh; overflow-y: auto; }
.modal-hdr { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); background: var(--primary); color: var(--white); border-radius: 12px 12px 0 0; font-size: 16px; font-weight: 600; }
.modal-hdr .modal-close { background: rgba(255,255,255,0.2); color: var(--white); width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.modal-hdr .modal-close:hover { background: rgba(255,255,255,0.35); }
.modal-card .form-group { padding: 0 20px; }
.modal-card .form-group:first-of-type { margin-top: 16px; }
.modal-card .btn-group { padding: 12px 20px 20px; }
.modal-card .form-row { padding: 0 20px; }

/* Stat card primary */
.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.primary .stat-value { color: var(--primary); }

/* Stat card primary */
.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.primary .stat-value { color: var(--primary); }

/* Tabs */
.tabs { display: flex; gap: 4px; }
.tab-btn { padding: 8px 18px; border: 1px solid var(--gray-200); background: var(--white); border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--gray-700); transition: all 0.15s; }
.tab-btn:hover { background: var(--gray-50); }
.tab-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Badge success */
.badge-success { background: var(--success-bg); color: var(--success); }
/* Badge danger */
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* Login page */
.login-container { max-width: 400px; margin: 80px auto; padding: 40px; background: var(--white); border-radius: 12px; box-shadow: var(--shadow-md); }
.login-container h2 { text-align: center; margin-bottom: 24px; color: var(--primary); }

/* Badge info */
.badge-info { background: var(--primary-lighter); color: var(--primary); }

/* ====== 历史成本分表（往期成本录入） ====== */
#histCostTbody .hist-input {
  font-variant-numeric: tabular-nums;
  color: var(--gray-800);
  transition: background 0.15s;
}
#histCostTbody .hist-input:focus {
  background: #fffdf3 !important;
  box-shadow: inset 0 0 0 2px var(--primary);
  border-radius: 3px;
}
#histCostTbody tr:hover { background: var(--gray-50); }
#histCostTbody tr:hover .hist-input { background: rgba(255,255,255,0.7); }
#histCostTfoot td { border-top: 2px solid var(--gray-300); padding: 10px 8px; font-size: 13px; }
#histCostTbody td { padding: 4px 8px; font-size: 13px; vertical-align: middle; }
/* 表格较宽时保持表头可见 */
#histCostTbody td:first-child, #histCostTfoot td:first-child { padding-left: 12px; }

/* 历史成本分表：列宽与紧凑排版修正 */
#histCostTbody td, #histCostTbody th { white-space: nowrap; }
#histCostTbody td:nth-child(1) { min-width: 130px; font-family: ui-monospace, monospace; font-size: 12px; }
#histCostTbody td:nth-child(2) { min-width: 200px; max-width: 260px; white-space: normal; line-height: 1.35; }
#histCostTbody .hist-input { min-width: 68px; }
/* 日期输入框在窄列中裁掉原生图标占位 */
#histCostTbody input[type="date"] { min-width: 128px; font-family: inherit; }
#histCostTbody input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.45; cursor: pointer; }
/* 合计列高亮 */
#histCostTbody td:nth-last-child(3) { background: #f7f9fc; font-weight: 600; }

/* ===== 外包预算表（仅总经理可见，预算管理参考） ===== */
#osTableWrap .table-wrap { max-height: 62vh; overflow: auto; }
#osTableWrap table { font-size: 13px; }
#osTableWrap thead th { position: sticky; top: 0; z-index: 2; background: var(--gray-50); }
#osTableWrap tbody tr.os-detail { background: #fff; }
#osTableWrap tbody tr.os-detail:hover { background: var(--gray-50); }
#osTableWrap tbody tr.os-detail td { border-bottom: 1px dashed var(--gray-200); }
#osTableWrap tbody tr.os-detail:last-of-type td { border-bottom: 1px solid var(--gray-200); }
#osTableWrap td:nth-child(2), #osTableWrap td:nth-child(4) { white-space: nowrap; }
#osTableWrap .badge { display: inline-block; }

/* ===== 历史成本悬停明细浮层 ===== */
.hc-tip {
  position: fixed;
  z-index: 100000;
  display: none;
  min-width: 280px;
  max-width: 420px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
  font-size: 12px;
  color: var(--gray-800);
  line-height: 1.55;
  pointer-events: auto;
  animation: hcTipIn .12s ease-out;
}
@keyframes hcTipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hc-tip-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.hc-tip-title { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.hc-tip-no { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--gray-500); }
.hc-tip-sub { font-size: 11px; color: var(--gray-500); padding-bottom: 8px; border-bottom: 1px solid var(--gray-200); margin-bottom: 8px; }
.hc-tip-bars { display: flex; flex-direction: column; gap: 5px; }
.hc-tip-bar-row { display: grid; grid-template-columns: 68px 1fr auto; align-items: center; gap: 8px; }
.hc-tip-bar-label { color: var(--gray-600); font-size: 11px; white-space: nowrap; }
.hc-tip-bar { display: block; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.hc-tip-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #5b8def, #3d6fd6); border-radius: 3px; }
.hc-tip-bar-val { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--gray-700); text-align: right; white-space: nowrap; }
.hc-tip-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--gray-200);
  font-size: 12px; font-weight: 600;
}
.hc-tip-total strong { font-size: 14px; color: var(--primary); font-family: ui-monospace, Consolas, monospace; }
.hc-tip-sep {
  margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--gray-300);
  font-size: 11px; font-weight: 600; color: var(--gray-500); margin-bottom: 6px;
}
.hc-tip-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--gray-600); }
.hc-tip-kv b { font-family: ui-monospace, Consolas, monospace; font-weight: 600; color: var(--gray-800); }
.hc-tip-note {
  margin-top: 9px; padding: 7px 9px; background: var(--gray-50); border-radius: 6px;
  font-size: 11px; color: var(--gray-600); line-height: 1.6; word-break: break-all;
  max-height: 8.5em; overflow-y: auto;
}
.hc-tip-note-label { display: inline-block; font-weight: 600; color: var(--gray-500); margin-right: 5px; }
.hc-tip-empty { font-size: 11px; color: var(--gray-400); padding: 4px 0; }
.hc-tip-foot { margin-top: 8px; font-size: 10px; color: var(--gray-400); }
/* 悬停锚点给出可交互的视觉暗示 */
.hc-tip-anchor { position: relative; }
.hc-tip-anchor:hover { box-shadow: inset 0 0 0 1px rgba(91, 141, 239, .45); }

/* ==================== 年度预算表 ==================== */
.ab-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 780px; }
.ab-table thead th {
  background: var(--gray-100); color: var(--gray-700); font-weight: 700; font-size: 12px;
  padding: 9px 12px; border-bottom: 1px solid var(--gray-200); line-height: 1.45;
  position: sticky; top: 0; z-index: 2;
}
.ab-table thead th:first-child { border-top-left-radius: 8px; }
.ab-table thead th:last-child { border-top-right-radius: 8px; }
.ab-table tbody td { padding: 8px 12px; border-bottom: 1px solid var(--gray-100); }
.ab-table tbody tr:hover td { background: var(--gray-50); }
/* 类别分隔行 */
.ab-table .ab-cat-row td {
  background: var(--primary-lighter); color: var(--primary); font-weight: 700; font-size: 12px;
  padding: 6px 12px; letter-spacing: .3px;
}
.ab-table .ab-cat-row:hover td { background: var(--primary-lighter); }
/* 派生行（成本合计 / 毛利率） */
.ab-table .ab-derived-row td { background: #F3F7F5; }
.ab-table .ab-derived-row:hover td { background: #EDF3F0; }
/* 编辑态：输入框 + 单位后缀（后缀不换行） */
.ab-edit-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; width: 100%; min-width: 96px; white-space: nowrap; }
.ab-edit-cell .ab-input { flex: 1 1 auto; min-width: 0; text-align: right; padding: 4px 6px; border: 1px solid var(--gray-300); border-radius: 5px; font-size: 13px; width: 100%; }
.ab-pct-sfx { flex: 0 0 auto; font-size: 11px; color: var(--gray-500); }
.ab-table .ab-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px var(--primary-lighter); }
.ab-table .ab-input::-webkit-outer-spin-button,
.ab-table .ab-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ab-table .ab-input { -moz-appearance: textfield; }

@media (max-width: 768px) {
  .ab-table { font-size: 12px; }
  .ab-table thead th, .ab-table tbody td { padding: 6px 8px; }
}

/* ==================== 回款与提成计算表 ==================== */
.cr-section { margin-bottom: 18px; }
.cr-section-title {
  background: var(--primary); color: var(--white); font-weight: 700; font-size: 13px;
  padding: 7px 14px; border-radius: 8px 8px 0 0; letter-spacing: .5px;
}
/* min-width 按各列 min-width 之和取值（9 列 ≈ 1052px），保证表头不挤压 */
.cr-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 1050px; }
.cr-table thead th {
  background: var(--gray-100); color: var(--gray-700); font-weight: 700; font-size: 12px;
  padding: 7px 10px; border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
.cr-table tbody td { padding: 6px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.cr-table tbody tr:hover td { background: var(--gray-50); }
/* 小计行 */
.cr-table .cr-subtotal td { background: var(--primary-lighter) !important; font-size: 13px; border-top: 1px solid var(--primary); }
.cr-table .cr-subtotal:hover td { background: var(--primary-lighter) !important; }
/* 备注子行 */
.cr-table .cr-note-row td { background: #FBFCFB; padding: 0 10px 6px 10px; border-bottom: 1px solid var(--gray-100); }
.cr-table .cr-note-row:hover td { background: #FBFCFB; }
/* 总计条 */
.cr-grand {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 10px 16px; margin-top: 4px; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: 10px; font-size: 14px; color: var(--gray-700);
}
.cr-grand b { font-size: 16px; font-family: ui-monospace, Consolas, monospace; }

/* 弹窗内字段 */
.cr-field { display: flex; flex-direction: column; gap: 4px; }
.cr-field > span { font-size: 12px; color: var(--gray-600); font-weight: 600; }
.cr-field input, .cr-field select {
  padding: 6px 9px; border: 1px solid var(--gray-300); border-radius: 6px;
  font-size: 13px; font-family: inherit; color: var(--gray-900); background: var(--white);
}
.cr-field input:focus, .cr-field select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-lighter);
}
.cr-field input[readonly] { cursor: default; }

@media (max-width: 768px) {
  .cr-table { font-size: 12px; }
  .cr-table thead th, .cr-table tbody td { padding: 5px 7px; }
  .cr-grand { font-size: 13px; }
}

/* 回款与提成弹窗：内容区与底部按钮栏（沿用 .modal-card 结构） */
.cr-modal-body { padding: 16px 20px 4px; }
.cr-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 18px; border-top: 1px solid var(--gray-100); margin-top: 14px; }

/* ---------- 提成分配：多条录入 ---------- */
.cr-alloc-head, .cr-alloc-row {
  display: grid; grid-template-columns: 1fr 150px 124px 32px; gap: 8px; align-items: center;
}
.cr-alloc-head { font-size: 12px; color: var(--gray-600); font-weight: 600; padding: 0 2px 6px; }
.cr-alloc-row { padding: 5px 2px; border-bottom: 1px dashed var(--gray-100); }
.cr-alloc-row:last-child { border-bottom: none; }
.cr-alloc-row input, .cr-alloc-row select {
  padding: 5px 8px; border: 1px solid var(--gray-300); border-radius: 6px;
  font-size: 13px; font-family: inherit; box-sizing: border-box; width: 100%; min-width: 0;
}
.cr-alloc-row input:focus, .cr-alloc-row select:focus { outline: none; border-color: var(--primary); }
.cr-alloc-row .dq-row-del { width: 26px; height: 26px; }
.cr-alloc-row .cr-alloc-amount { text-align: right; font-variant-numeric: tabular-nums; }
/* 自动配平的最后一行：淡色底提示由系统计算，手动输入后即变为普通样式 */
.cr-alloc-row.cr-alloc-auto .cr-alloc-amount { background: #f2f8ff; color: var(--primary, #2563eb); font-weight: 600; }
.cr-alloc-addline { display: flex; align-items: center; gap: 8px; padding: 8px 0 4px; }
.cr-alloc-sum {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
  margin-top: 6px; padding: 9px 12px; font-size: 12.5px;
  background: var(--gray-50, #f9fafb); border: 1px solid var(--gray-200, #e5e7eb); border-radius: 8px;
}
.cr-alloc-sum b { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .cr-alloc-head { display: none; }
  .cr-alloc-row { grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 2px; }
  .cr-alloc-row .cr-alloc-person { grid-column: 1 / -1; }
  .cr-alloc-row .dq-row-del { justify-self: end; }
}

/* 分表标题右侧条目数 */
.cr-sec-count {
  float: right; background: rgba(255,255,255,0.22); color: var(--white);
  font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 9px; margin-top: 1px;
}
/* 项目号下拉（可搜索）：加宽并等宽字体，便于对照项目号 */
.cr-proj-select {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  width: 100%;
}
.cr-proj-select option { font-family: ui-monospace, Consolas, monospace; }
/* 日期输入统一外观 */
.cr-field input[type="date"] { font-family: inherit; }

/* ============================================================
   设计报价（成本预算控制 → 设计报价）
   ============================================================ */
/* Tab 切换 */
.dq-tabs { display: flex; gap: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--gray-200); }
.dq-tab {
  background: none; border: none; cursor: pointer; padding: 8px 16px; font-size: 14px;
  color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit;
}
.dq-tab:hover { color: var(--gray-700); }
.dq-tab-on { color: var(--primary, #2563eb); border-bottom-color: var(--primary, #2563eb); font-weight: 600; }

/* 分组块 */
/* 弹窗内只有 .form-group/.form-row/.btn-group 自带 20px 内边距，
   分组块与顶部说明是裸元素，需显式补内边距，否则内容会贴住弹窗左右边缘。 */
.dq-group { margin: 14px 0; padding: 0 20px; }
.dq-group-title {
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  padding: 4px 0 8px; border-bottom: 1px dashed var(--gray-200); margin-bottom: 10px;
}
/* 成本弹窗顶部的填写说明文字 */
.dq-hint { padding: 0 20px; margin-top: 10px; font-size: 12px; color: var(--gray-500); line-height: 1.7; }

/* 手填项：竖向排列（每行一个字段）
   布局：字段名（左，定宽）→ 输入框 + 单位（中，定宽）→ 备注（右，自适应可编辑）
   早期版本用 4 列横向网格，字段名在输入框上方；现改为逐行竖排，
   右侧留出备注列，预填原表说明且允许手动修改。*/
.dq-fill-list { display: flex; flex-direction: column; gap: 6px; }
.dq-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0; border-bottom: 1px dashed var(--gray-100, #eef2ef);
}
.dq-row:last-child { border-bottom: none; }
.dq-row-name {
  width: 92px; flex: none; font-size: 12px; color: var(--gray-600);
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dq-row-input { display: flex; align-items: center; gap: 6px; flex: none; }
.dq-row-input em {
  font-style: normal; font-size: 11px; color: var(--gray-400);
  white-space: nowrap; min-width: 34px;
}
/* 备注框：右侧自适应，虚线边框提示「可编辑」，聚焦时高亮 */
input.dq-note {
  flex: 1; min-width: 0; padding: 4px 8px; font-size: 11.5px;
  color: var(--gray-600); background: #fff; font-family: inherit; box-sizing: border-box;
  border: 1px dashed var(--gray-200, #dde5e0); border-radius: 5px;
}
input.dq-note::placeholder { color: var(--gray-300, #c2cbc6); }
input.dq-note:hover { border-color: #a5d6a7; }
input.dq-note:focus {
  outline: none; border-style: solid; border-color: #66bb6a;
  background: #f4fbf5; color: var(--gray-800, #1f2937);
}

/* 窄屏：字段名与输入框仍同行，备注换到下一行占满宽度 */
@media (max-width: 620px) {
  .dq-row { flex-wrap: wrap; }
  .dq-row-name { width: 76px; }
  input.dq-note { flex-basis: 100%; margin-left: 86px; }
}

/* 兼容旧类名：报价弹窗（比例输入）仍复用 */
.dq-fill-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dq-fill-label { font-size: 12px; color: var(--gray-600); }
.dq-fill-input { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dq-fill-input em { font-style: normal; font-size: 11px; color: var(--gray-400); white-space: nowrap; }
/* 派生值旁的附加说明（如「内部价格」的公式） */
.dq-derived-note {
  font-style: normal; font-size: 10.5px; color: var(--gray-400);
  margin-left: 6px; font-weight: 400;
}
input.dq-fill {
  flex: 1; min-width: 0; width: 100%; padding: 5px 8px; font-size: 13px;
  border: 1px solid #a5d6a7; border-radius: 6px;
  background: #e8f5e9;              /* 绿底：手动填写项 */
  font-family: inherit; box-sizing: border-box;
}
input.dq-fill:focus { outline: none; border-color: #66bb6a; background: #dff2e1; }
/* 竖排时输入框统一宽度，避免不同单位长度造成参差 */
.dq-row .dq-row-input input.dq-fill { width: 110px; flex: none; }

/* ---------- 「四、管理费 + 利润」分组的自定义费用项 ---------- */
/* 「+」插入条：夹在「专家费」与「管理摊销」之间 */
.dq-add-line { display: flex; align-items: center; gap: 8px; padding: 4px 0 6px; }
.dq-add-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; font-size: 11.5px; font-family: inherit; cursor: pointer;
  color: #2e7d32; background: #f1f8f2;
  border: 1px dashed #a5d6a7; border-radius: 999px;
  transition: background .15s, border-color .15s;
}
.dq-add-btn:hover { background: #e3f3e5; border-color: #66bb6a; border-style: solid; }
.dq-add-btn:active { background: #d7ecd9; }
.dq-add-tip { font-size: 10.5px; color: var(--gray-400); }

/* 自定义费用项行：整行淡蓝底 + 左侧色条，与固定字段区分（但仍是绿底输入框） */
.dq-row-custom {
  background: #f5f9fd; border-radius: 6px; padding: 4px 6px;
  border-left: 3px solid #90caf9;
}
.dq-row-custom .dq-row-name { width: 92px; flex: none; }
/* 名称输入框占满名称列 */
.dq-row-custom .dq-custom-name { display: flex; }
input.dq-custom-input {
  width: 100%; min-width: 0; box-sizing: border-box; padding: 4px 6px; font-size: 12px;
  font-family: inherit; color: var(--gray-800, #1f2937);
  border: 1px solid #cfe3f7; border-radius: 5px; background: #fff;
}
input.dq-custom-input:hover { border-color: #90caf9; }
input.dq-custom-input:focus { outline: none; border-color: #64b5f6; background: #fbfdff; }
/* 备注框与固定行一致，占满剩余宽度 */
.dq-row-custom input.dq-note { flex: 1; min-width: 0; }

/* 行尾删除按钮 */
.dq-row-del {
  flex: none; width: 22px; height: 22px; line-height: 1; padding: 0;
  font-size: 12px; font-family: inherit; cursor: pointer;
  color: #c62828; background: #fff; border: 1px solid #ffcdd2; border-radius: 5px;
  transition: background .15s, border-color .15s;
}
.dq-row-del:hover { background: #ffebee; border-color: #ef9a9a; }

/* 窄屏：删除按钮不换行挤到角落 */
@media (max-width: 620px) {
  .dq-row-custom .dq-row-del { align-self: flex-end; }
}

/* 派生计算结果：灰底只读 */
.dq-derived-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dq-derived-cell {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; background: var(--gray-100, #f3f4f6); border-radius: 6px; font-size: 12px;
}
.dq-derived-label { color: var(--gray-600); }
.dq-derived-value { font-weight: 600; color: var(--gray-800, #1f2937); font-family: ui-monospace, Consolas, monospace; }

/* 比例输入行 */
.dq-ratio-grid { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.dq-ratio-grid .dq-fill-cell { min-width: 130px; }
.dq-ratio-sum { font-size: 13px; padding-bottom: 6px; }

/* 预览区：贴近导出版式（无底色、有边框） */
.dq-preview {
  border: 1px solid var(--gray-200); border-radius: 8px; padding: 18px 20px;
  background: #fff; overflow-x: auto;
}
.dq-pv-title { text-align: center; font-size: 19px; font-weight: 700; letter-spacing: 4px; margin-bottom: 14px; }
.dq-pv-meta { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; gap: 12px; flex-wrap: wrap; }
.dq-pv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dq-pv-table th, .dq-pv-table td { border: 1px solid #333; padding: 6px 8px; vertical-align: middle; }
.dq-pv-table th { background: none; font-weight: 600; text-align: center; }
.dq-pv-table td { text-align: center; }
.dq-pv-num { text-align: right !important; font-family: ui-monospace, Consolas, monospace; }
.dq-pv-sign { display: flex; justify-content: space-between; font-size: 13px; margin-top: 26px; gap: 20px; flex-wrap: wrap; }

/* ===== 月度绩效汇总：奖惩备注输入框 ===== */
/* 「奖惩」列可为负数（扣款惩罚）；备注用于备忘奖惩事由 */
.perf-note-input {
  width: 100%; min-width: 0; box-sizing: border-box;
  padding: 3px 7px; font-size: 11.5px; font-family: inherit;
  color: var(--gray-700, #374151); background: #fff;
  border: 1px dashed var(--gray-200, #dde5e0); border-radius: 5px;
}
.perf-note-input::placeholder { color: var(--gray-300, #c2cbc6); }
.perf-note-input:hover { border-color: #a5d6a7; }
.perf-note-input:focus {
  outline: none; border-style: solid; border-color: #66bb6a; background: #f4fbf5;
}

/* ===== 回款与提成：提成发放状态 ===== */
/* 未发放的条目整行浅绿底（插入分配表完成分配后自动变「已发放」） */
.cr-table tbody tr.cr-row-unpaid > td { background: #eef9f0; }
/* 项目待确认：左侧黄条提示，可与未发放底色叠加，不丢失原有提醒 */
.cr-table tbody tr.cr-row-warn > td:first-child { box-shadow: inset 3px 0 0 #f0c040; }
/* 状态徽标（非管理员只读）/ 下拉（管理员可改） */
.cr-payout-badge,
.cr-payout-select {
  display: inline-block; font-size: 11.5px; line-height: 1.4; font-family: inherit;
  padding: 2px 8px; border-radius: 9px; white-space: nowrap; border: 1px solid transparent;
}
.cr-payout-badge.is-unpaid,
.cr-payout-select.is-unpaid { background: #dff2e1; color: #2e7d32; border-color: #a5d6a7; }
.cr-payout-badge.is-paid,
.cr-payout-select.is-paid   { background: #eef2ef; color: var(--gray-600, #4b5563); border-color: var(--gray-200, #dde5e0); }
.cr-payout-select { cursor: pointer; outline: none; }
.cr-payout-select:hover { filter: brightness(0.97); }

/* ===== 回款催收清单：已达标 / 未达标 分组标题行 ===== */
.ov-group > td {
  background: #f2f6f3; border-top: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200);
  padding: 7px 10px; text-align: left;
}
.ov-group.is-ok > td { background: #ecf7ed; }
.ov-group.is-ng > td { background: #f4f5f6; }
.ov-group-title { font-size: 12.5px; font-weight: 700; color: var(--gray-700, #374151); }
.ov-group-sub { font-size: 11.5px; color: var(--gray-500); margin-left: 10px; }
.ov-group-note { font-size: 11px; color: var(--gray-400); margin-left: 10px; }

/* ===== 回款编辑弹窗：商务负责人「可输入下拉」 ===== */
/* 原生 datalist 在输入框有值时会过滤候选（只显示匹配项），故改为自定义下拉面板 */
.cr-bm-combo { position: relative; }
.cr-bm-combo input { width: 100%; box-sizing: border-box; padding-right: 26px; }
.cr-bm-arrow {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 22px; line-height: 1; padding: 0; border: none;
  background: transparent; cursor: pointer; font-size: 11px; color: var(--gray-500);
}
.cr-bm-arrow:hover { color: var(--primary); }
.cr-bm-menu {
  position: absolute; z-index: 300; left: 0; right: 0; top: 100%; margin-top: 4px;
  max-height: 208px; overflow-y: auto; padding: 4px;
  background: #fff; border: 1px solid var(--gray-200, #dde5e0); border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .10);
}
.cr-bm-item { padding: 6px 10px; font-size: 13px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.cr-bm-item:hover { background: var(--primary-lighter, #eef4ff); color: var(--primary); }
.cr-bm-empty { padding: 6px 10px; font-size: 12px; color: var(--gray-400, #9aa4b2); }

/* ===== 另计费绩效：表头筛选栏 ===== */
.pe-filter {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 12px;
  background: #f7f9fc; border: 1px solid var(--gray-200, #dde5e0); border-radius: 8px;
}
.pe-filter-label { font-size: 12px; font-weight: 600; color: var(--gray-600, #5b6672); }
.pe-filter select,
.pe-filter input {
  padding: 6px 10px; font-size: 13px; border: 1px solid var(--gray-300, #cfd8e3);
  border-radius: 6px; background: #fff; height: 32px; box-sizing: border-box;
}
.pe-filter input { flex: 1; min-width: 220px; }
.pe-filter select { min-width: 118px; }
.pe-filter-stat { margin-left: auto; font-size: 12px; color: var(--gray-600, #5b6672); white-space: nowrap; }
.pe-filter-stat b { color: var(--primary); }
@media (max-width: 900px) {
  .pe-filter-stat { margin-left: 0; width: 100%; }
}

/* ===== 预算控制：年度标签 + 明细表筛选 ===== */
.budget-year-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.budget-year-tabs .tab-btn { padding: 7px 16px; font-size: 13px; }
.budget-filter select { min-width: 112px; }
.budget-filter input { flex: 0 1 220px; }

/* ===== 项目一页纸总览 ===== */
.op-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.op-toolbar select { min-width: 320px; max-width: 100%; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--gray-200); border-radius: 8px; background: #fff; height: 36px; }
.op-head { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 14px; }
.op-no { font-family: Consolas, monospace; font-size: 12px; background: var(--primary-lighter);
  color: var(--primary); padding: 3px 10px; border-radius: 6px; font-weight: 700; }
.op-title h2 { font-size: 19px; font-weight: 700; margin: 8px 0 6px; color: var(--gray-900); }
.op-meta { font-size: 12.5px; color: var(--gray-500); margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; }
.op-terminated { background: var(--danger-bg); color: var(--danger); font-size: 13px; font-weight: 600;
  padding: 10px 14px; border-radius: 8px; margin: 6px 0 12px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px 18px; }
.kpi label { font-size: 12px; color: var(--gray-500); display: block; margin-bottom: 6px; }
.kpi b { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.kpi b i { font-size: 12px; font-style: normal; color: var(--gray-500); font-weight: 500; margin-left: 2px; }
.kpi .pri { color: var(--primary); }
.kpi .pos { color: var(--success); }
.kpi .neg { color: var(--danger); }
.op-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.op-grid .card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px 18px; }
.op-grid .card.span2 { grid-column: span 2; }
.op-grid .card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--gray-900);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cur-stage { font-size: 12px; color: var(--gray-500); font-weight: 500; }
.stages { display: flex; margin: 6px 0 14px; }
.stage { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--gray-500); }
.stage i { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--gray-200);
  margin: 0 auto 6px; position: relative; z-index: 1; }
.stage:after { content: ""; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px; background: var(--gray-200); }
.stage:first-child:after { display: none; }
.stage.done { color: var(--primary); font-weight: 600; }
.stage.done i { background: var(--primary); }
.stage.done:after { background: var(--primary); }
.stage.now { color: var(--primary); font-weight: 700; }
.stage.now i { background: #fff; border: 3px solid var(--primary); }
.prog-list { border-top: 1px solid var(--gray-100); padding-top: 10px; }
.prow { display: flex; gap: 10px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--gray-100); align-items: center; }
.prow:last-child { border: 0; }
.pstage { flex: 0 0 90px; font-weight: 600; color: var(--gray-700); }
.pfin { flex: 1; color: var(--gray-500); }
.pdate { font-size: 11.5px; color: var(--gray-500); font-family: Consolas; white-space: nowrap; }
.cbar { display: flex; align-items: center; gap: 10px; margin: 9px 0; font-size: 12.5px; }
.cbar-l { flex: 0 0 88px; color: var(--gray-700); }
.cbar-t { flex: 1; height: 10px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.cbar-t i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-light), var(--primary)); border-radius: 99px; }
.cbar-v { flex: 0 0 74px; text-align: right; font-family: Consolas; font-weight: 600; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0;
  border-bottom: 1px dashed var(--gray-100); gap: 12px; }
.kv span { color: var(--gray-500); flex: 0 0 auto; }
.kv b { text-align: right; font-weight: 600; }
.kv.total { border-bottom: 0; border-top: 2px solid var(--gray-200); margin-top: 6px; font-size: 13.5px; }
.kv.total b { color: var(--primary); }
.ell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ell2 { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.inv-no { font-size: 11px; color: var(--gray-500); font-family: Consolas; }
.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.t th { background: var(--gray-50); text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--gray-200);
  font-size: 12px; color: var(--gray-700); white-space: nowrap; }
.t td { padding: 7px 8px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.t .num { text-align: right; font-family: Consolas; }
.empty { color: var(--gray-500); font-size: 12.5px; text-align: center; padding: 10px 0; }
.chip { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.chip.ok { background: var(--primary-lighter); color: var(--primary); font-weight: 600; }
.chip.wait { background: var(--warning-bg); color: var(--warning); font-weight: 600; }

/* ===== 人员负荷视图 ===== */
.lv-toolbar { display: flex; justify-content: space-between; align-items: center; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px;
  flex-wrap: wrap; gap: 10px; }
.lv-sum { font-size: 13.5px; color: var(--gray-700); }
.lv-sum b { font-size: 16px; color: var(--primary); }
.lv-legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lv { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.lv thead th { background: var(--primary-lighter); }
.p-row { cursor: pointer; }
.p-row:hover { background: var(--gray-50); }
.load-bar { height: 8px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.load-bar i { display: block; height: 100%; border-radius: 99px; }
.load-bar i.lo { background: #8FA89F; }
.load-bar i.mid { background: #C9A86A; }
.load-bar i.hi { background: var(--danger); }
.chip.lv-lo { background: var(--gray-100); color: var(--gray-700); font-weight: 600; }
.chip.lv-mid { background: var(--warning-bg); color: var(--warning); font-weight: 600; }
.chip.lv-hi { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.p-detail { display: none; }
.p-detail.open { display: table-row; }
.p-detail td { background: var(--gray-50); padding: 10px 14px; }
.pd-in b { font-size: 12.5px; color: var(--gray-700); display: block; margin-bottom: 6px; }
.lv-note { font-size: 12px; color: var(--gray-500); margin-top: 10px; line-height: 1.7; }

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .op-grid { grid-template-columns: 1fr; }
  .op-grid .card.span2 { grid-column: span 1; }
  .op-toolbar select { min-width: 0; flex: 1; }
}

/* ===== 打印：一页纸总览 / 人员负荷视图 ===== */
@media print {
  .sidebar, .topbar, .op-toolbar, .page-header, .lv-legend .btn, .lv-note, .back-home-btn { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; }
  .op-grid .card, .lv, .lv-toolbar { break-inside: avoid; }
  .p-detail { display: none !important; }
}
