/* ── Custom Gantt View ── */
.gantt-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.milestone-legend {
  display: flex; gap: 14px; font-size: 11px; color: var(--text-secondary);
}
.milestone-legend span { display: flex; align-items: center; gap: 4px; }
.milestone-legend .dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.dot-m1 { background: #e74c3c; }
.dot-m2 { background: #f39c12; }
.dot-m3 { background: #3498db; }
.dot-m4 { background: #2ecc71; }
.gantt-scale-toggle, .gantt-density-toggle { font-size: 11px; }

.gantt-scroll {
  flex: 1;
  overflow: auto;
  position: relative;
}
.gantt-grid {
  position: relative;
  min-width: fit-content;
}
.gantt-empty {
  display: flex; align-items: center; justify-content: center;
  height: 300px; color: var(--text-muted); font-size: 14px;
}

/* Header */
.gantt-header-row {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border);
}
.gantt-header-label {
  position: sticky;
  left: 0;
  z-index: 6;
  width: var(--gantt-label-width, 360px);
  min-width: var(--gantt-label-width, 360px);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.gantt-header-timeline { display: flex; }
.gantt-header-month {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  border-right: 1px solid var(--border-light);
  padding: 8px 0;
  background: var(--bg-tertiary);
}
.gantt-header-month.today-month {
  color: var(--accent);
  background: var(--accent-light);
}
[data-theme="dark"] .gantt-header-month {
  color: #d0d4de;
}
[data-theme="dark"] .gantt-header-label {
  color: #d0d4de;
}
[data-theme="dark"] .gantt-header-month.today-month {
  color: #8eaaff;
  background: rgba(91, 123, 249, 0.18);
}
[data-theme="c128"] .gantt-header-month {
  color: #22bb22;
}
[data-theme="c128"] .gantt-header-label {
  color: #22bb22;
}
[data-theme="c128"] .gantt-header-month.today-month {
  color: #33ff33;
  background: rgba(51, 255, 51, 0.12);
}
[data-theme="ur6000"] .gantt-header-month {
  color: #cc8800;
}
[data-theme="ur6000"] .gantt-header-label {
  color: #cc8800;
}
[data-theme="ur6000"] .gantt-header-month.today-month {
  color: #ffb000;
  background: rgba(255, 176, 0, 0.12);
}
[data-theme="haven3019"] .gantt-header-month {
  color: #8fa8c8;
}
[data-theme="haven3019"] .gantt-header-label {
  color: #8fa8c8;
}
[data-theme="haven3019"] .gantt-header-month.today-month {
  color: #7eb8d4;
  background: rgba(126, 184, 212, 0.12);
}
[data-theme="high-contrast"] .gantt-header-month {
  color: #eeeeee;
}
[data-theme="high-contrast"] .gantt-header-label {
  color: #eeeeee;
}
[data-theme="high-contrast"] .gantt-header-month.today-month {
  color: #ffff00;
  background: rgba(255, 255, 0, 0.15);
}

/* Rows */
.gantt-row {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}
.gantt-row:hover .gantt-row-label,
.gantt-row:hover .gantt-row-timeline { background: var(--accent-light) !important; }

.gantt-row-label {
  position: sticky;
  left: 0;
  z-index: 2;
  width: var(--gantt-label-width, 360px);
  min-width: var(--gantt-label-width, 360px);
  padding: 3px 8px 3px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  border-left: 4px solid transparent;
  overflow: hidden;
}
.gantt-row:nth-child(even) .gantt-row-label { background: var(--bg-primary); }
.gantt-label-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  line-height: 1.3;
}
.gantt-label-client {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Timeline */
.gantt-row-timeline {
  flex: 1;
  position: relative;
  background: var(--bg-secondary);
}
.gantt-row:nth-child(even) .gantt-row-timeline { background: var(--bg-primary); }
.gantt-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-light);
}

/* Bars */
.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 20px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 4px;
  z-index: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.gantt-bar.clipped-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 3px solid rgba(255,255,255,0.5);
}
.gantt-bar.clipped-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 3px solid rgba(255,255,255,0.5);
}

/* Milestones */
.gantt-milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Today line */
.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  z-index: 4;
  opacity: 0.8;
  pointer-events: none;
}
.gantt-today-label {
  position: sticky;
  top: 0;
  display: block;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 0 0 3px 3px;
  white-space: nowrap;
  width: fit-content;
}
[data-theme="c128"] .gantt-today-label { background: #0a140a; color: #33ff33; border: 1px solid #33ff33; }
[data-theme="ur6000"] .gantt-today-label { background: #0d0a00; color: #ffb000; border: 1px solid #ffb000; }
[data-theme="haven3019"] .gantt-today-label { background: #0d1520; color: #7eb8d4; border: 1px solid #7eb8d4; }
[data-theme="high-contrast"] .gantt-today-label { background: #ffff00; color: #000000; border: 1px solid #ffff00; }

/* Out of range */
.gantt-out-of-range {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
}

/* Gantt label resize handle */
.gantt-label-resize-handle {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  z-index: 7;
}
.gantt-label-resize-handle:hover,
.gantt-label-resize-handle.dragging {
  background: var(--accent);
  opacity: 0.4;
}

/* Gantt group header */
.gantt-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--accent);
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

/* Projector-only bar styling */
.gantt-bar.gantt-bar-projector {
  opacity: 0.7;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.15) 4px,
    rgba(255,255,255,0.15) 8px
  ) !important;
  border: 1.5px dashed rgba(255,255,255,0.5);
}
.gantt-bar.gantt-bar-late-start {
  opacity: 0.85;
  border: 2px dashed #dc3545;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(220,53,69,0.15) 5px,
    rgba(220,53,69,0.15) 10px
  ) !important;
}
