/* ============================================
   Project Plan Page - Gantt Chart
   ============================================ */

.plan-page {
  background: #f5f5f5;
  font-family: 'Noto Sans SC', 'Source Han Sans CN', sans-serif;
}

/* plan 页面：header 强制显示背景，颜色与页面背景一致 */
.plan-page .main-header::before {
  opacity: 1;
  background: rgba(245, 245, 245, 0.97);
}

/* ============================================
   顶部工具栏
   ============================================ */
/* 外层容器：白色背景，200px，内容底部对齐 */
.plan-toolbar {
  position: fixed;
  top: calc(90px + 16px); /* header高度 + 间距 */
  left: 24px;
  right: 24px;
  height: 68px;
  background: #fff;
  z-index: 20;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  overflow: hidden;
}

.plan-toolbar__top    { display: none; }
.plan-toolbar__heading { display: none; }
.plan-toolbar__logo   { display: none; }

/* 工具栏块：一行布局 */
.plan-toolbar__body {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}

/* 标题：左侧，与其他页面主标题一致 */
.plan-toolbar__title {
  font-size: 18px;
  font-weight: 600;
  color: #000;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
  margin-right: 32px;
  padding-right: 32px;
  border-right: 1px solid rgba(0,0,0,0.08);
}

.plan-toolbar__controls {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  height: 100%;
  flex: 1;
  overflow-x: auto;
}

.plan-toolbar__group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 100%;
  flex-shrink: 0;
}

.plan-toolbar__group--summary {
  display: flex;
  align-items: center;
  gap: 24px;
}

.plan-toolbar__label {
  font-size: 12px;
  color: rgba(0,0,0,0.4);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.plan-toolbar__divider {
  width: 1px;
  height: 24px;
  background: rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.plan-toolbar__hint {
  font-size: 11px;
  color: rgba(0,0,0,0.55);
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0,0,0,0.04);
  border-radius: 6px;
  padding: 4px 10px;
  margin-right: 8px;
}

.plan-toolbar__steps-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #000;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.plan-toolbar__steps-btn:hover {
  background: #ebebeb;
}

/* ---- 缩放控件 ---- */
.plan-toolbar__group--zoom {
  gap: 4px;
}

.plan-zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 8px;
  color: rgba(0,0,0,0.6);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-size: 13px;
  font-family: inherit;
  flex-shrink: 0;
}

.plan-zoom-btn svg {
  width: 15px;
  height: 15px;
}

.plan-zoom-btn:hover {
  background: #f0f0f0;
  color: #000;
}

.plan-zoom-btn--fit {
  width: auto;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  background: #000;
  color: #fff;
  border-radius: 8px;
}

.plan-zoom-btn--fit:hover {
  background: #222;
  color: #fff;
}

.plan-help-btn {
  margin-left: 4px;
  color: rgba(0,0,0,0.45);
}

.plan-help-btn:hover,
.plan-help-btn.is-active {
  background: #f0f0f0;
  color: #000;
}

.plan-zoom-label {
  font-size: 12px;
  color: rgba(0,0,0,0.5);
  min-width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---- 名列行选中状态（Ctrl+点击） ---- */
.plan-name-row.is-selected {
  background: rgba(0,0,0,0.06);
}

.plan-name-row.is-selected .plan-name-row__text {
  font-weight: 600;
  color: #000;
}

/* ============================================
   Mega Menu 步骤选择面板
   ============================================ */
.plan-mega-menu {
  position: fixed;
  top: calc(90px + 16px + 68px + 8px); /* header + 间距 + toolbar + 卡片间距 */
  left: 24px;
  right: 24px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 19;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.34,1.56,0.64,1),
              transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.plan-mega-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.plan-mega-menu__inner {
  display: flex;
  flex: 1;
  padding: 0;
  overflow-x: hidden; /* 全宽不需要横向滚动 */
  overflow-y: auto;
  max-height: calc(100vh - 90px - 16px - 68px - 8px - 40px);
}

/* 每个服务列：等宽铺满全宽 */
.plan-mega-col {
  flex: 1;
  min-width: 0;
  border-right: 1px solid rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
}

.plan-mega-col:last-child {
  border-right: none;
}

.plan-mega-col__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 12px;
  background: #fafafa;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 1;
}

.plan-mega-col__check-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.plan-mega-col__check-wrap input {
  width: 13px;
  height: 13px;
  accent-color: #000;
  cursor: pointer;
  margin: 0;
}

.plan-mega-col__title {
  font-size: 13px;
  font-weight: 700;
  color: #000;
  letter-spacing: -0.01em;
  line-height: 1.3;
  flex: 1;
}

.plan-mega-col__steps {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

/* ---- Step Item ---- */
.plan-step-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.12s;
}

.plan-step-item:hover {
  background: rgba(0,0,0,0.03);
}

.plan-step-item input {
  width: 12px;
  height: 12px;
  accent-color: #000;
  cursor: pointer;
  margin: 0;
  justify-self: center;
}

.plan-step-name {
  font-size: 13px;
  color: #000;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-step-time {
  font-size: 11px;
  color: rgba(0,0,0,0.3);
  white-space: nowrap;
  text-align: right;
}

/* ============================================
   摘要（工具栏内）
   ============================================ */
.plan-summary__item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.plan-summary__key {
  font-size: 11px;
  color: rgba(0,0,0,0.35);
  letter-spacing: 0.02em;
}

.plan-summary__val {
  font-size: 12px;
  font-weight: 500;
  color: #000;
  white-space: nowrap;
}

/* ============================================
   主体区域
   ============================================ */
.plan-main {
  padding-top: calc(90px + 16px + 68px + 16px);
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 24px;
  height: 100vh;
  position: relative;
  z-index: 10;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
}

/* ---- 空状态 ---- */
.plan-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: calc(100vh - 90px - 16px - 68px - 16px);
  color: rgba(0,0,0,0.2);
  font-size: 13px;
}

/* ============================================
   甘特图容器（主流设计）
   ============================================ */
.plan-gantt {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ---- 左侧：固定任务名列 ---- */
.plan-gantt__names {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.08);
  overflow-x: hidden;
  overflow-y: clip; /* clip 不创建滚动容器，sticky 可正常生效 */
  background: #fff;
}

.plan-gantt__axis-spacer {
  height: 40px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 4;
}

.plan-gantt__names-list {
  will-change: transform;
}

.plan-name-row {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  box-sizing: border-box;
}

.plan-name-row__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.plan-name-row__text {
  font-size: 12px;
  color: #000;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.plan-name-row__dur {
  font-size: 10px;
  color: rgba(0,0,0,0.35);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- 右侧：可滚动时间轴 ---- */
.plan-gantt__timeline {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  min-width: 0;
  position: relative;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.plan-gantt__timeline::-webkit-scrollbar { display: none; }

/* 日期轴容器：固定在顶部，不参与 flex 布局 */
.plan-axis {
  height: 40px;
  flex-shrink: 0;
  display: flex;
  cursor: ew-resize;
  align-items: stretch;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 5;
}

.plan-axis__weeks {
  display: flex;
}

.plan-axis__week {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8px;
  border-right: 1px solid rgba(0,0,0,0.06);
  box-sizing: border-box;
}

.plan-axis__wk-num {
  font-size: 10px;
  font-weight: 600;
  color: rgba(0,0,0,0.5);
  line-height: 1;
}

.plan-axis__wk-date {
  font-size: 10px;
  color: rgba(0,0,0,0.3);
  line-height: 1;
  margin-top: 2px;
}

/* 内容区域（轴下方）：相对定位容器 */
.plan-timeline__body {
  position: relative;
  flex: 1;
  min-height: 400px;
  min-width: 100%;
}

/* ---- 网格 ---- */
.plan-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  pointer-events: none;
  z-index: 0;
}

.plan-grid__line {
  flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.06);
  height: 100%;
}

/* ---- 图表区域 ---- */

/* ---- 甘特行 ---- */
.plan-row {
  position: relative;
  height: 52px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  box-sizing: border-box;
}

/* ---- 甘特条 ---- */
.plan-bar {
  position: absolute;
  height: 28px;
  border-radius: 6px;
  background: #111;
  z-index: 1;
  transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s;
}

.plan-bar:hover {
  opacity: 0.85;
}

/* 吸附端点圆点：定位在吸附边的垂直中心 */
.plan-snap-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #000;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 20;
}

/* ---- 并行行：斜线填充标识 ---- */
.plan-bar.is-parallel-bar {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.25) 4px,
    rgba(255,255,255,0.25) 6px
  ) !important;
}

/* Mega Menu 并行点 */
.plan-step-parallel-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  background: #000;
}

.plan-name-row__parallel { display: none; }

/* ---- 日期标签（显示在条右侧） ---- */
.plan-bar__date-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: rgba(0,0,0,0.4);
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
  /* left 由 JS 动态设置为 bar宽度+8px */
}

/* ============================================
   日期选择器
   ============================================ */
.plan-datepicker {
  position: relative;
}

.plan-datepicker__display {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
  white-space: nowrap;
}

.plan-datepicker__display:hover {
  background: #ebebeb;
}

.plan-datepicker__val {
  font-size: 13px;
  color: rgba(0,0,0,0.4);
  font-family: inherit;
}

.plan-datepicker__val.has-value {
  color: #000;
}

.plan-datepicker__popup {
  position: fixed;
  top: auto;
  background: #fff;
  padding: 16px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 300;
  display: none;
  width: 260px;
}

.plan-datepicker__popup.is-open {
  display: block;
}

.plan-datepicker__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.plan-datepicker__nav-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #000;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
  padding: 0;
}

.plan-datepicker__nav-btn:hover { background: #f0f0f0; }

.plan-datepicker__month-label {
  font-size: 14px;
  font-weight: 600;
  color: #000;
}

.plan-datepicker__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.plan-datepicker__weekdays span {
  font-size: 11px;
  color: rgba(0,0,0,0.35);
  text-align: center;
  padding: 4px 0;
}

.plan-datepicker__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.plan-datepicker__day {
  background: none;
  border: none;
  font-size: 13px;
  font-family: inherit;
  color: #000;
  cursor: pointer;
  padding: 5px 2px;
  border-radius: 5px;
  text-align: center;
  transition: background 0.12s;
}

.plan-datepicker__day:hover { background: #f0f0f0; }
.plan-datepicker__day.is-selected { background: #000; color: #fff; }

/* ============================================
   鼠标竖向标注线
   ============================================ */
#planCrosshair {
  position: absolute;
  top: 0;
  display: none;
  pointer-events: none;
  z-index: 10;
  transform: translateX(-0.5px);
}

.plan-crosshair__line {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
  background: rgba(0,0,0,0.18);
}

#planCrosshair.is-snapped .plan-crosshair__line {
  background: rgba(0,0,0,0.5);
  width: 1px;
}

.plan-crosshair__label {
  position: fixed; /* 固定在视口，不随内容滚动 */
  /* top 由 JS 动态设置，始终贴在轴底部 */
  background: #000;
  color: #fff;
  font-size: 11px;
  font-family: inherit;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

#planCrosshair.is-snapped .plan-crosshair__label {
  background: #000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.plan-chart {
  position: relative;
  min-height: 400px;
  cursor: crosshair;
}

.plan-gantt__timeline.is-drag-mode,
.plan-gantt__timeline.is-drag-mode * {
  cursor: move !important;
}

/* ============================================
   区间标记（点击两端点显示区间卡片）
   ============================================ */
.plan-range-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.05);
  border-left: 2px solid rgba(0,0,0,0.25);
  border-right: 2px solid rgba(0,0,0,0.25);
  pointer-events: none;
  z-index: 3;
}

.plan-mark-pin {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #000;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 12;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.plan-range-card {
  position: fixed;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  padding: 16px 20px;
  min-width: 220px;
  max-width: 300px;
  z-index: 200;
  pointer-events: none;
}

.plan-range-card__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.plan-range-card__row:last-child { margin-bottom: 0; }

.plan-range-card__key {
  font-size: 10px;
  color: rgba(0,0,0,0.35);
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding-top: 1px;
  min-width: 28px;
}

.plan-range-card__val {
  font-size: 12px;
  font-weight: 500;
  color: #000;
  line-height: 1.4;
}

.plan-range-card__divider {
  height: 1px;
  background: rgba(0,0,0,0.07);
  margin: 10px 0;
}

.plan-range-card__total {
  font-size: 20px;
  font-weight: 700;
  color: #000;
  letter-spacing: -0.5px;
}

.plan-range-card__total-unit {
  font-size: 12px;
  font-weight: 400;
  color: rgba(0,0,0,0.4);
  margin-left: 2px;
}

.plan-range-card__svc-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.plan-range-card__svc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.plan-range-card__svc-name {
  font-size: 11px;
  font-weight: 600;
  color: #000;
  flex: 1;
}

.plan-range-card__svc-days {
  font-size: 11px;
  font-weight: 600;
  color: #000;
  white-space: nowrap;
}

.plan-range-card__svc-detail {
  margin-bottom: 3px;
}

.plan-range-card__svc-stage {
  font-size: 11px;
  color: rgba(0,0,0,0.65);
  line-height: 1.4;
}

.plan-range-card__svc-dates {
  font-size: 10px;
  color: rgba(0,0,0,0.38);
  margin-bottom: 2px;
  letter-spacing: 0.01em;
}

/* ============================================
   右键上下文菜单
   ============================================ */
.plan-ctx-menu {
  position: fixed;
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  z-index: 300;
  min-width: 180px;
  overflow: hidden;
  padding: 6px 0;
}

.plan-ctx-menu__title {
  font-size: 11px;
  color: rgba(0,0,0,0.4);
  padding: 4px 14px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.plan-ctx-menu__divider {
  height: 1px;
  background: rgba(0,0,0,0.07);
  margin: 2px 0;
}

.plan-ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  font-size: 13px;
  color: #000;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s;
}
.plan-ctx-menu__item:hover { background: #f5f5f5; }

/* ============================================
   操作指引卡片
   ============================================ */
.plan-help-card {
  position: fixed;
  top: 200px; /* 由JS动态设置，与日期标签保持相同间距 */
  right: 32px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  z-index: 50;
  width: 220px;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}

.plan-help-card.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.plan-help-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.plan-help-card__title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(0,0,0,0.5);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plan-help-card__close {
  background: none;
  border: none;
  font-size: 16px;
  color: rgba(0,0,0,0.3);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.12s;
}
.plan-help-card__close:hover { color: #000; }

.plan-help-card__body {
  padding: 10px 14px 12px;
}

.plan-help-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}

.plan-help-key {
  font-size: 10px;
  font-weight: 500;
  color: #000;
  background: #f3f3f3;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.plan-help-desc {
  font-size: 11px;
  color: rgba(0,0,0,0.5);
  text-align: right;
}

.plan-help-section {
  font-size: 9px;
  font-weight: 700;
  color: rgba(0,0,0,0.3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 8px 0 4px;
}

.plan-help-section:first-child { margin-top: 0; }

.plan-help-divider {
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 6px 0;
}

/* ============================================
   动画 Keyframes
   ============================================ */

/* 行入场：从左淡入 */
@keyframes planRowIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 进度条展开：从左侧 scaleX 展开 */
@keyframes planBarIn {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

/* 卡片弹出：scale + fade（不覆盖 translate 定位） */
@keyframes planCardIn {
  from { opacity: 0; scale: 0.96; }
  to   { opacity: 1; scale: 1; }
}

/* Pin bounce 入场 */
@keyframes planPinIn {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  60%  { transform: translate(-50%, -50%) scale(1.3); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 右键菜单弹出 */
@keyframes planCtxIn {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* 操作指引卡片从右滑入 */
@keyframes planHelpIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 行入场动画 class（JS 动态添加） */
.plan-name-row.is-entering {
  animation: planRowIn 0.25s ease both;
}

/* 进度条入场（transform-origin 左侧） */
.plan-bar.is-entering {
  transform-origin: left center;
  animation: planBarIn 0.3s ease both;
}

/* 区间卡片动画 */
.plan-range-card.is-visible {
  animation: planCardIn 0.2s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* 右键菜单动画 */
.plan-ctx-menu.is-visible {
  animation: planCtxIn 0.15s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* 操作指引卡片初始动画 */
.plan-help-card.is-intro {
  animation: planHelpIn 0.35s 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* 吸附点 tooltip */
.plan-snap-tooltip {
  position: fixed;
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  letter-spacing: 0.02em;
  opacity: 0;
  /* 消失：快速淡出+收缩 */
  transition: opacity 0.12s ease,
              transform 0.12s ease;
}

/* 开始端（左侧）：初始向左偏移 */
.plan-snap-tooltip[data-dir="start"] {
  transform: translateX(-16px) scale(0.88);
}
.plan-snap-tooltip[data-dir="start"].is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  /* 滑入：弹性 spring 曲线 */
  transition: opacity 0.22s ease,
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 结束端（右侧）：初始向右偏移 */
.plan-snap-tooltip[data-dir="end"] {
  transform: translateX(16px) scale(0.88);
}
.plan-snap-tooltip[data-dir="end"].is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  transition: opacity 0.22s ease,
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mark pin 动画 */
.plan-mark-pin {
  animation: planPinIn 0.25s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* 区间高亮：无过渡，实时跟随鼠标 */
.plan-range-highlight {
  transition: none;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 900px) {
  /* ---- 工具栏：两行明确布局 ---- */
  .plan-toolbar {
    top: calc(70px + 10px);
    left: 12px;
    right: 12px;
    height: auto;
    overflow: hidden;
  }

  .plan-toolbar__body {
    flex-wrap: wrap;
    padding: 0 16px;
    gap: 0;
    align-items: stretch;
    height: auto;
  }

  /* 第一行：标题 + 缩放（高度 48px） */
  .plan-toolbar__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    border-right: none;
    flex: 1;
    display: flex;
    align-items: center;
    height: 48px;
    order: 0;
  }

  .plan-toolbar__group--zoom {
    order: 1;
    margin-left: 0;
    height: 48px;
    padding: 0 0 0 8px;
    gap: 2px;
  }

  /* 强制换行占位 */
  .plan-toolbar__body::after {
    content: '';
    width: 100%;
    order: 2;
    height: 0;
    border-top: 1px solid rgba(0,0,0,0.06);
  }

  /* 第二行：日期 + 步骤 + 摘要（高度 44px） */
  .plan-toolbar__group {
    height: 44px;
    padding: 0 12px 0 0;
    order: 3;
    flex-shrink: 0;
  }

  .plan-toolbar__group--zoom { order: 1; } /* 覆盖回第一行 */

  .plan-toolbar__group--summary {
    order: 3;
    gap: 16px;
    padding: 0 0 0 4px;
    flex: 1;
    justify-content: flex-end;
  }

  /* 提示文字、分隔线隐藏 */
  .plan-toolbar__hint    { display: none; }
  .plan-toolbar__divider { display: none; }

  /* 主体区域：toolbar 两行 = 48+44+1 = 93px，多留 208px 余量 */
  .plan-main {
    padding-top: calc(70px + 10px + 101px + 50px);
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 12px;
  }

  .plan-empty {
    height: calc(100vh - 70px - 10px - 101px - 50px);
  }

  /* Mega Menu */
  .plan-mega-menu {
    top: calc(70px + 10px + 101px + 50px + 6px);
    left: 12px;
    right: 12px;
  }

  .plan-mega-menu__inner {
    flex-direction: column;
    max-height: calc(100vh - 70px - 10px - 101px - 8px - 6px - 40px);
  }

  .plan-mega-col {
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  .plan-mega-col:last-child { border-bottom: none; }

  .plan-mega-col__steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  /* 甘特图名列缩窄 */
  .plan-gantt__names { width: 120px; }

  .plan-name-row {
    padding: 0 8px;
    gap: 5px;
    height: 44px;
  }

  .plan-name-row__text { font-size: 11px; }
  .plan-name-row__dur  { display: none; }

  /* 甘特行高同步缩小 */
  .plan-row { height: 44px; }
  .plan-bar { height: 24px; }

  /* 操作指引卡片移动端隐藏 */
  .plan-help-card { display: none; }

  /* 适合按钮：移动端只显示图标，隐藏文字 */
  .plan-zoom-btn--fit {
    width: 36px;
    padding: 0;
    font-size: 0;
    gap: 0;
  }
  .plan-zoom-btn--fit svg {
    width: 14px;
    height: 14px;
  }

  /* 百分比标签：强制显示，缩小宽度 */
  .plan-zoom-label {
    display: block;
    min-width: 28px;
    font-size: 11px;
  }

  /* 日期选择器弹出层适配小屏 */
  .plan-datepicker__popup {
    width: calc(100vw - 24px);
    max-width: 300px;
  }
}

@media (max-width: 600px) {
  .plan-toolbar {
    top: calc(60px + 8px);
    left: 8px;
    right: 8px;
  }

  .plan-toolbar__body {
    padding: 0 12px;
  }

  .plan-toolbar__title { font-size: 14px; }

  /* 摘要移动端隐藏（空间不够） */
  .plan-toolbar__group--summary { display: none; }

  /* toolbar 两行 = 101px */
  .plan-main {
    padding-top: calc(60px + 8px + 101px + 50px);
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: 8px;
  }

  .plan-empty {
    height: calc(100vh - 60px - 8px - 101px - 50px);
  }

  .plan-gantt__names { width: 90px; }
  .plan-name-row__dot { width: 6px; height: 6px; }

  .plan-mega-menu {
    top: calc(60px + 8px + 101px + 50px + 6px);
    left: 8px;
    right: 8px;
  }

  .plan-mega-menu__inner {
    max-height: calc(100vh - 60px - 8px - 101px - 8px - 6px - 40px);
  }

  .plan-mega-col__steps {
    grid-template-columns: 1fr;
  }

  /* 缩放标签隐藏，按钮缩小 */
  .plan-zoom-label { display: none; }
  .plan-zoom-btn { width: 30px; height: 30px; }

  /* 日期选择器弹出层居中 */
  .plan-datepicker__popup {
    width: calc(100vw - 16px);
    left: 8px !important;
    right: 8px !important;
  }
}

