* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-soft: #edf2f7;
  --text: #1a202c;
  --muted: #718096;
  --faint: #a0aec0;
  --today: #ef4444;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* 顶部 */
.top { background: linear-gradient(120deg, #1a365d, #2b6cb0 55%, #4299e1); color: #fff; padding: 40px 0 34px; }
.wrap { width: 100%; max-width: 1500px; margin: 0 auto; padding: 0 32px; }
.top h1 { font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.top .sub { margin-top: 10px; font-size: 14px; opacity: .82; }
.top .wrap { position: relative; }

/* 主区域：flex 撑满剩余高度 */
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 0 40px;
}
main .wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* 工具条：图例 + 缩放 */
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-shrink: 0; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 14px; height: 14px; border-radius: 4px; transition: transform .12s; }
.legend span:hover .dot { transform: scale(1.2); }

.zoom { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.zoom button {
  width: 30px; height: 30px; border: none; border-radius: 6px;
  background: #f1f5fb; color: #2d3748; font-size: 18px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.zoom button:hover { background: #e2e8f0; }
.zoom button:disabled { opacity: .35; cursor: not-allowed; }
.zoom span { min-width: 48px; text-align: center; font-size: 13px; color: var(--muted); }

/* 甘特图卡片：占据剩余空间 */
.chart {
  flex: 1;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  overflow: auto;
  display: flex;
}
/* chart-inner 宽度由 JS 显式设定（= 标签列 + 图表宽）。
   flex-shrink: 0 必须保留：否则它会被 flex 压缩回一屏宽，
   sticky 标签列的可活动范围就只有一屏，滚远了照样消失 */
.chart-inner { display: flex; flex-shrink: 0; width: max-content; min-width: 100%; }

/* 左侧标签列 */
.labels { width: 200px; flex-shrink: 0; background: #fbfcfe; border-right: 1px solid var(--line); position: sticky; left: 0; z-index: 3; }
.corner {
  height: 46px; display: flex; align-items: center; padding: 0 14px;
  font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line-soft);
  background: #f1f5fb; color: var(--muted);
}
/* 每个部分 = 左侧部分名 + 负责人行，高度与右侧完全对齐 */
.label { display: flex; border-bottom: 1px solid var(--line); overflow: hidden; }
.part-name {
  flex-shrink: 0; width: 78px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 13px; font-weight: 700; color: #4a5568; text-align: center;
  background: #f1f5fb; border-right: 1px dashed var(--line);
  padding: 6px 4px; line-height: 1.4;
}
.label-count { font-size: 10.5px; color: var(--faint); font-weight: 400; }
.lane-names { flex: 1; min-width: 0; }
.lane-name {
  display: flex; align-items: center; padding: 0 12px;
  font-size: 12.5px; color: #4a5568;
  border-bottom: 1px dashed var(--line-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lane-name:last-child { border-bottom: none; }

/* 网格区域（表格 + 行） */
/* 宽度由 JS 按 chartW 显式设定，保证与刻度/条形完全对齐 */
.grid-wrap { flex: none; position: relative; }
.timeline { display: flex; height: 46px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.timeline .mcell { flex-shrink: 0; text-align: center; font-size: 13px; color: var(--muted); line-height: 46px; border-right: 1px solid var(--line); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* 行：每个负责人一行（lane），按可用高度平均分配 */
.row { position: relative; border-bottom: 1px dashed var(--line-soft); }
/* 部分的最后一行：用实线与下一个部分分隔 */
.row.part-end { border-bottom: 1px solid var(--line); }
.row .stripes { position: absolute; inset: 0; display: flex; }
.row .stripes i { flex-shrink: 0; border-right: 1px solid #f0f4f8; }

/* 今日竖线 */
.today-line { position: absolute; top: 46px; bottom: 0; width: 2px; background: var(--today); opacity: .7; z-index: 2; pointer-events: none; }

/* 条形 */
.bar {
  position: absolute; top: 50%; transform: translateY(-50%);
  min-height: 42px;
  border-radius: 7px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px;
  padding: 6px 12px; font-size: 13px; color: #fff;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .12s, box-shadow .12s, filter .12s;
  z-index: 1;
}
.bar:hover { transform: translateY(-50%) translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.28); filter: brightness(1.06); }
.bar.hw { background: linear-gradient(135deg, #e53e3e, #f56565); }
.bar.sw { background: linear-gradient(135deg, #3182ce, #4299e1); }
.bar.op { background: linear-gradient(135deg, #dd6b20, #ed8936); }
.bar .bar-owners { display: flex; flex-wrap: wrap; gap: 4px; white-space: normal; }
.bar .owner-chip {
  display: inline-block; background: rgba(255,255,255,.22); padding: 1px 8px; border-radius: 20px;
  font-size: 11px; white-space: nowrap;
}

/* 模态框 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 480px; position: relative; padding: 26px 28px; animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.close { position: absolute; top: 12px; right: 16px; font-size: 26px; color: var(--faint); cursor: pointer; line-height: 1; }
.close:hover { color: #4a5568; }
.modal-body h2 { font-size: 19px; margin-bottom: 4px; padding-right: 24px; }
.modal-body .tag { display: inline-block; font-size: 12px; color: #fff; padding: 3px 10px; border-radius: 20px; margin-bottom: 14px; }
.modal-body .tag.hw { background: #e53e3e; }
.modal-body .tag.sw { background: #3182ce; }
.modal-body .tag.op { background: #dd6b20; }
.modal-body .kv { display: flex; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line-soft); font-size: 14px; }
.modal-body .kv b { color: var(--muted); width: 70px; flex-shrink: 0; font-weight: 500; }
.modal-body .kv p { flex: 1; line-height: 1.6; }

.foot { text-align: center; padding: 16px; font-size: 12px; color: var(--faint); flex-shrink: 0; }