/* ============================================================
   产线项目管理 · 主题与新增组件
   在 style.css 之后加载，做两件事：
     ① 把品牌色统一到「中车红」，并修掉 style.css 里写死的旧蓝色
     ② 新增：顶部导航、统计概览独立页、右侧待办栏与任务日历
   ============================================================ */

/* ---------- ① 旧蓝色遗留处统一为中车红 ---------- */
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(192, 17, 26, .12); }
table.grid th {
  background: #fbf1f2;
  color: var(--brand-dark);
  border-bottom-color: var(--brand-line);
}
table.grid tbody tr:hover td { background: #fdf7f7; }
.stage-grid td.cell-edit input:focus,
.stage-grid td.cell-edit textarea:focus,
.stage-grid td.cell-edit select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(192, 17, 26, .1); }
.tree-input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(192, 17, 26, .1); }
.panel-title h2 { color: var(--brand-dark); }
.foldbar-btn { color: var(--brand-dark); }
.kpi .kpi-value { color: var(--brand-dark); }
.kpi.accent-doing .kpi-value { color: var(--doing); }
.kpi.accent-done .kpi-value { color: var(--ok); }
.kpi.accent-soon .kpi-value { color: var(--key); }
.kpi.accent-over .kpi-value { color: var(--danger); }
.btn-convert { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.btn-convert:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }

/* 卡片质感 */
.panel { border-radius: var(--radius); }
.kpi { border-radius: var(--radius); transition: transform .12s ease, box-shadow .12s ease, border-color .12s; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-hi); border-color: var(--brand-line); }
.kpi.clickable::after { color: var(--brand); }
.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }

/* ---------- ② 顶部导航（项目管理 / 统计概览） ---------- */
.topnav { display: flex; gap: 4px; margin-left: 14px; }
.nav-item {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 17px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .10);
  color: rgba(255, 255, 255, .88);
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.nav-item.active {
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
}

/* ---------- ③ 主视图：左内容 + 右侧栏 ---------- */
.view-split { display: flex; gap: 14px; align-items: stretch; min-height: 0; }
.split-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.split-main > .panel-fill { flex: 1 1 auto; min-height: 0; }
.split-side {
  flex: 0 0 322px;
  width: 322px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 2px;
}
.side-card { border-radius: var(--radius); flex: 0 0 auto; }
.side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.side-head h3 { font-size: 13.5px; color: var(--brand-dark); display: flex; align-items: center; gap: 6px; }
.side-badge {
  display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center;
}
.side-body { padding: 9px; max-height: 300px; overflow-y: auto; }
.side-empty { padding: 20px 10px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.7; }
.side-more { padding: 7px; text-align: center; color: var(--muted); font-size: 11.5px; }

/* 待办条目 */
.todo-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--line); border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.todo-item:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.ti-icon {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand);
}
.ti-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ti-main b { font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.ti-main span { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.ti-approve { border-left-color: var(--key); }
.ti-approve .ti-icon { background: var(--key-soft); color: var(--key); }
.ti-overdue { border-left-color: #d6453a; }
.ti-overdue .ti-icon { background: var(--danger-soft); color: var(--danger); }
.ti-soon { border-left-color: #e0a01e; }
.ti-soon .ti-icon { background: var(--key-soft); color: var(--key); }
.ti-fill, .ti-progress { border-left-color: var(--doing); }
.ti-fill .ti-icon, .ti-progress .ti-icon { background: var(--doing-soft); color: var(--doing); }

/* 日历 */
.cal-nav { display: inline-flex; align-items: center; gap: 2px; }
.cal-month { font-size: 12px; color: var(--text-2); min-width: 74px; text-align: center; }
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  padding: 9px 12px 0; font-size: 11px; color: var(--text-2);
}
.cal-legend .lg { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.cal-over { background: #d6453a; }
.dot.cal-soon { background: #e0a01e; }
.dot.cal-task { background: #2f7cc4; }
.dot.cal-node { background: #9aa3b2; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head { padding: 7px 8px 2px; }
.cal-head span { text-align: center; font-size: 11px; color: var(--muted); }
.cal-grid { padding: 0 8px 8px; gap: 2px; }
.cal-cell {
  min-height: 36px; padding: 3px 2px;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  font: inherit; cursor: pointer; transition: background .12s, border-color .12s;
}
.cal-cell.blank { visibility: hidden; }
.cal-cell:hover { background: var(--brand-soft); }
.cal-cell.has { background: #fafbfc; border-color: var(--line); }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--brand-2); }
.cal-cell.sel { background: var(--brand-soft); border-color: var(--brand-2); }
.cal-num { font-size: 11.5px; color: var(--text-2); line-height: 1.2; }
.cal-cell.has .cal-num { color: var(--text); font-weight: 600; }
.cal-dots { display: flex; gap: 2px; min-height: 7px; }
.cal-day { padding: 8px 11px 12px; border-top: 1px solid var(--line); }
.cal-day-head { font-size: 11.5px; color: var(--muted); margin-bottom: 7px; }
.cal-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  width: 100%; text-align: left; padding: 6px 9px; margin-bottom: 5px;
  border: 1px solid var(--line); border-left: 3px solid var(--line-strong);
  border-radius: 7px; background: #fff; font: inherit; font-size: 12px; cursor: pointer;
}
.cal-item:hover { background: var(--brand-soft); border-color: var(--brand-line); }
.cal-item span { font-size: 11px; color: var(--muted); }
.cal-item.cal-over { border-left-color: #d6453a; }
.cal-item.cal-soon { border-left-color: #e0a01e; }
.cal-item.cal-task { border-left-color: #2f7cc4; }
.cal-item.cal-node { border-left-color: #9aa3b2; }

/* ---------- ④ 统计概览独立页 ---------- */
#viewStats { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.stats-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 2px 2px 0;
}
.stats-head h2 { font-size: 18px; color: var(--brand-dark); letter-spacing: .2px; }
.stats-head p { margin: 3px 0 0; }
.stats-bar { background: transparent; border: 0; box-shadow: none; padding: 0 2px; }
.stats-bar .foldbar-summary { white-space: normal; font-size: 12.5px; line-height: 2; }
.stats-charts { flex: 0 0 auto; }
.stats-blocks {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px; padding: 15px 17px 18px;
}
.stat-block h4 { margin: 0 0 11px; font-size: 13px; color: var(--brand-dark); }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row {
  display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 9px;
  width: 100%; padding: 3px 5px; border: 0; border-radius: 7px;
  background: transparent; font: inherit; font-size: 12.5px; cursor: pointer; text-align: left;
}
.bar-row:hover { background: var(--brand-soft); }
.bar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 9px; border-radius: 6px; background: #eef0f4; overflow: hidden; }
.bar-track.big { height: 12px; margin: 9px 0 12px; }
.bar-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.bar-value { text-align: right; font-weight: 700; color: var(--brand-dark); }
.stat-big { font-size: 26px; font-weight: 700; color: var(--brand-dark); line-height: 1.2; }
.stat-big span { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-rows { display: flex; flex-wrap: wrap; gap: 9px; }
.stat-link {
  border: 1px solid var(--brand-line); background: #fff; color: var(--brand);
  border-radius: 999px; padding: 5px 13px; font: inherit; font-size: 12px; cursor: pointer;
}
.stat-link:hover { background: var(--brand-soft); }

/* ---------- 窄屏：右栏落到下方 ---------- */
@media (max-width: 1180px) {
  .view-split { flex-direction: column; }
  .split-side { flex: 1 1 auto; width: 100%; max-height: none; }
}
