/* Gantt Chart Modern Styles */

.gantt-wrapper {
  display: flex;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  font-family: 'Inter', sans-serif;
  user-select: none; /* Disable text selection */
}

.gantt-sidebar {
  width: 250px;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  z-index: 20;
  transition: width 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.gantt-sidebar.collapsed {
  width: 0;
  border-right: none;
  overflow: visible; /* Allow toggle to be visible */
}

.gantt-sidebar.collapsed .gantt-sidebar-header {
  position: absolute;
  left: 0;
  top: 0;
  width: 50px;
  z-index: 100;
  background: transparent;
  border: none;
  padding: 0;
  justify-content: center;
}

.gantt-sidebar.collapsed .gantt-sidebar-title {
  display: none;
}

.gantt-sidebar.collapsed .gantt-sidebar-body {
  display: none; /* Hide body content to prevent overlap */
}

.gantt-sidebar-header {
  height: 50px;
  min-height: 50px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  font-weight: 600;
  background: var(--color-background);
  color: var(--color-text-secondary);
}

.gantt-sidebar-toggle {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.gantt-sidebar-toggle:hover {
  background: var(--color-background-hover);
  color: var(--color-primary);
}

.gantt-sidebar-toggle.active {
  background: var(--color-primary);
  color: #fff;
}

.gantt-sidebar-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}

.gantt-sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-surface);
  /* Hide scrollbar but keep scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.gantt-sidebar-body::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Responsive: Auto-collapse sidebar on narrow screens */
@media (max-width: 768px) {
  .gantt-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-right: none;
    overflow: visible; /* Allow hamburger to overflow */
  }
  
  /* Sidebar header stays visible even when collapsed */
  .gantt-sidebar .gantt-sidebar-header {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    z-index: 100; /* High z-index to ensure visibility */
    border: none;
    background: transparent;
  }
  
  /* When expanded on mobile */
  .gantt-sidebar.expanded {
    width: 250px;
    border-right: 1px solid var(--color-border);
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    overflow: visible; /* Ensure content isn't clipped during transition if possible */
  }
  
  .gantt-sidebar.expanded .gantt-sidebar-header {
    position: static;
    width: auto;
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
  }
  
  /* Sidebar body hidden by default on mobile */
  .gantt-sidebar .gantt-sidebar-body {
    opacity: 0;
    pointer-events: none;
  }
  
  .gantt-sidebar.expanded .gantt-sidebar-body {
    opacity: 1;
    pointer-events: auto;
  }
  
  /* Adjust main area for toggle button space */
  .gantt-header-wrapper {
    padding-left: 50px;
  }
}

.gantt-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.gantt-header-wrapper {
  height: 50px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
  /* Hide scrollbar but keep scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.gantt-header-wrapper::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.gantt-time-header {
  display: flex;
  height: 100%;
}

.gantt-header-block {
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column; /* Stack upper and main labels */
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.header-upper {
  font-size: 10px;
  color: #64748b; /* darkgray */
  margin-bottom: 2px;
  text-transform: none;
}

.header-main {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.gantt-body-scroll {
  flex: 1;
  overflow: auto;
  position: relative;
}

.gantt-body {
  position: relative;
  min-width: 100%;
  width: fit-content;
  background-color: var(--color-surface);
  /* Use CSS Grid for background lines */
  background-image: 
    linear-gradient(var(--color-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border) 1px, transparent 1px);
  background-size: 100% 40px, 60px 100%; /* Vertical step matches rowHeight, horizontal will be adjusted in JS if needed, or kept generic */
}

.gantt-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Rows */
.gantt-row {
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 13px;
  color: var(--color-text);
  transition: background-color 0.1s;
}

.gantt-row:hover {
  background-color: var(--color-background);
}

.project-item {
  background: var(--color-surface-hover);
  border-left: 3px solid var(--color-primary);
}

.drag-handle {
  cursor: grab;
  color: #94a3b8;
  margin-right: 8px;
  display: flex;
  align-items: center;
}
.drag-handle:active {
  cursor: grabbing;
}

/* Drop Targets */
.gantt-row.drop-target-top {
  border-top: 2px solid #3b82f6 !important;
}
.gantt-row.drop-target-bottom {
  border-bottom: 2px solid #3b82f6 !important;
}
.gantt-row.drop-target-active {
  background-color: rgba(59, 130, 246, 0.1);
}

.milestone-item {
  font-style: italic;
  color: var(--color-text-secondary);
}

.task-item {
  /* default */
}

.gantt-sidebar-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 8px;
  color: var(--color-text-secondary);
}

.gantt-sidebar-icon:hover {
  color: var(--color-primary);
}

/* Bars Layer */
.gantt-bars-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; 
}

.gantt-bar-wrapper {
  position: absolute;
  pointer-events: auto;
}

.gantt-bar {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.gantt-bar:active {
  cursor: grabbing;
}

.project-bar {
  background: var(--color-primary);
  opacity: 0.8;
  border-radius: 10px; /* pill shape for projects */
}

/* Milestones */
.milestone-wrapper {
  z-index: 12;
  pointer-events: auto;
  cursor: grab;
}
.milestone-wrapper:active {
  cursor: grabbing;
}
.gantt-milestone {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  pointer-events: auto;
  position: relative;
}
/* SVG inside milestone handles shape and color, no need for background */
.gantt-milestone svg { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15)); }

.task-bar {
  background: #94a3b8; 
}
/* RAGB Status Border Colors: Grey (todo), Amber (in_progress), Red (review), Blue (done) */
.task-bar.todo { border: 2px solid #9ca3af; }
.task-bar.in_progress { border: 2px solid #f59e0b; }
.task-bar.review { border: 2px solid #ef4444; }
.task-bar.done { border: 2px solid #3b82f6; }

.gantt-bar-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(0,0,0,0.1);
  border-radius: 4px 0 0 4px;
}


.gantt-bar-label {
  margin-left: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.gantt-bar-text {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff; /* Ensure contrast, maybe shadow */
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Fallback */
    max-width: calc(100% - 8px);
    pointer-events: none;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.drag-handle.right-aligned {
    margin-right: 0;
    margin-left: auto;
}

.project-bar .gantt-bar-label.sticky {
  position: sticky; /* nice for project names */
  left: 10px;
}

/* Handles */
.gantt-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
  z-index: 2;
  opacity: 0;
  pointer-events: auto; /* Ensure handles are clickable */
}
.gantt-handle:hover { opacity: 1; background: rgba(0,0,0,0.1); }
.gantt-bar:hover .gantt-handle { opacity: 0.5; } /* Show handles on bar hover */
.gantt-handle.left { left: 0; border-radius: 4px 0 0 4px; }
.gantt-handle.right { right: 0; border-radius: 0 4px 4px 0; }

/* Connectors */
.gantt-connector {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border: 1px solid #64748b;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
  cursor: crosshair;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
  pointer-events: auto;
}
.gantt-bar-wrapper:hover .gantt-connector,
.gantt-bar:hover .gantt-connector,
.gantt-milestone:hover .gantt-connector,
.milestone-wrapper:hover .gantt-connector { opacity: 1; }
.gantt-connector.left { left: -4px; }
.gantt-connector.right { right: -4px; }

.gantt-connector:hover {
  background: #3b82f6;
  transform: translateY(-50%) scale(1.2);
}

/* Dependencies */
.gantt-dependency-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none; /* Layer ignores clicks, but children can override */
  z-index: 5;
  overflow: visible;
}

.gantt-dependency-line {
  pointer-events: stroke; /* Only click the actual line */
  cursor: pointer;
  transition: stroke 0.2s, stroke-width 0.2s;
}

.gantt-dependency-line:hover {
  stroke: #3b82f6;
  stroke-width: 3px;
}

.gantt-dependency-line.selected {
  stroke: #ef4444; /* Red to indicate selection/danger */
  stroke-width: 3px;
  filter: drop-shadow(0 1px 2px rgba(239, 68, 68, 0.3));
}

/* Today Line */
.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 4;
  pointer-events: none;
}

.gantt-tooltip {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.gantt-bar:hover + .gantt-tooltip {
  opacity: 1;
}

/* Modal Styles */
.gantt-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s;
}
.gantt-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.gantt-modal-content {
  background: #fff;
  width: 400px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}
.gantt-modal-header {
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gantt-modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #1e293b; }
.gantt-modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #64748b; }
.gantt-modal-close:hover { color: #1e293b; }

.gantt-modal-body { padding: 16px; }
.form-group { margin-bottom: 12px; }
.form-group-row { display: flex; gap: 12px; }
.form-group label { display: block; font-size: 12px; margin-bottom: 4px; color: #64748b; font-weight: 500; }
.gantt-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-sizing: border-box; 
  font-size: 13px;
  transition: border-color 0.2s;
}
.gantt-input:focus { border-color: #3b82f6; outline: none; }

.gantt-modal-footer {
  padding: 16px;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
}
.btn-cancel {
  padding: 8px 16px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
}
.btn-cancel:hover { background: #f1f5f9; }

.btn-save {
  padding: 8px 16px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.btn-save:hover { background: #2563eb; }

/* Toolbar Styles */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 99px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pill:hover {
  background: var(--color-background-hover);
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.btn-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.view-toggle {
  display: flex;
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle .btn-pill {
  border: none;
  background: transparent;
  height: 32px;
}

.view-toggle .btn-pill.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.time-scale-select-wrapper select.btn-pill {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 32px;
}

/* Projects Toolbar */
.projects-toolbar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.projects-toolbar .view-toggle {
  width: auto;
  flex-shrink: 0;
}

/* Action Group - combined select + button */
.action-group {
  display: flex;
  align-items: center;
}

.action-group-select {
  height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 99px 0 0 99px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: all 0.2s;
}

.action-group-select:hover {
  border-color: var(--color-border-hover);
  background-color: var(--color-background-hover);
}

.action-group-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.action-group-select.hidden {
  display: none;
}

.action-group-select.hidden + .action-group-btn {
  border-radius: 99px;
}

.action-group-btn {
  height: 36px;
  width: 36px;
  padding: 0;
  border: 1px solid var(--color-primary);
  border-radius: 0 99px 99px 0;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.action-group-btn:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.action-group-btn svg {
  width: 20px;
  height: 20px;
}

/* Button label visibility */
.btn-pill .btn-label {
  margin-left: 6px;
}

@media (max-width: 768px) {
  .btn-pill .btn-label {
    display: none;
  }
  
  .action-group-select {
    width: 80px;
    padding-right: 24px;
  }
}


/* Gantt Modal Tabs */
.gantt-modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  padding: 0 16px;
  background: #f8fafc;
  margin-top: 0;
}

.gantt-modal-tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.gantt-modal-tab:hover {
  color: var(--color-text-primary);
}

.gantt-modal-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.gantt-tab-pane {
  display: none;
}

.gantt-tab-pane.active {
  display: block;
}

/* Enhanced Form Elements */
.gantt-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.gantt-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 32px;
  cursor: pointer;
}

.gantt-range {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  cursor: pointer;
  flex: 1;
}

.gantt-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.progress-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-value {
  font-size: 13px;
  font-weight: 600;
  color: #3b82f6;
  min-width: 36px;
}

/* Sub-Task Counter Badge */
.subtask-counter {
  display: inline-block;
  background: #e0e7ff;
  color: #3b82f6;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Sub-Task Add Wrapper */
.subtask-add-wrapper {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.subtask-add-wrapper .gantt-input {
  flex: 1;
}

/* Cost Add Wrapper */
.cost-add-wrapper {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.cost-add-wrapper .gantt-input {
  flex: 1;
}

.btn-add-subtask {
  width: 36px;
  height: 36px;
  border: none;
  background: #3b82f6;
  color: #fff;
  border-radius: 6px;
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-add-subtask:hover {
  background: #2563eb;
}

/* Sub-Task List */
.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.subtask-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.subtask-item.completed {
  background: #f0fdf4;
}

.subtask-item.completed .subtask-title {
  text-decoration: line-through;
  color: #94a3b8;
}

/* Custom Checkbox */
.subtask-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.subtask-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.subtask-checkbox .checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.subtask-checkbox:hover .checkmark {
  border-color: #3b82f6;
}

.subtask-checkbox input:checked ~ .checkmark {
  background: #22c55e;
  border-color: #22c55e;
}

.subtask-checkbox input:checked ~ .checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Sub-Task Title (Editable) */
.subtask-title {
  flex: 1;
  font-size: 13px;
  color: #334155;
  outline: none;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.subtask-title:focus {
  border-color: #3b82f6;
  background: #fff;
}

/* Sub-Task Delete Button */
.subtask-delete {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #94a3b8;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
}

.subtask-item:hover .subtask-delete {
  opacity: 1;
}

.subtask-delete:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Sub-Task Empty State */
.subtask-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: #64748b;
  text-align: center;
}

.subtask-empty p {
  font-size: 13px;
  margin: 0;
}

/* Form Group Row Fixes */
.form-group-row {
  display: flex;
  gap: 12px;
}

.form-group-row .form-group {
  flex: 1;
}

/* Modal Header with Edit Toggle */
.modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-edit-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-edit-toggle:hover {
  background: #e2e8f0;
}

.btn-edit-toggle svg {
  color: #3b82f6;
  transition: color 0.2s;
}

[data-edit-mode="false"] .btn-edit-toggle svg {
  color: #94a3b8;
}

/* Rich Text Editor */
.richtext-toolbar {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.richtext-toolbar button {
  width: 28px;
  height: 28px;
  border: none;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.richtext-toolbar button:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
  margin: 0 4px;
}

.gantt-richtext-toolbar {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.gantt-richtext-toolbar button {
  width: 28px;
  height: 28px;
  border: none;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.gantt-richtext-toolbar button:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.gantt-richtext {
  min-height: 80px;
  border-radius: 0 0 6px 6px;
  border-top: none;
  line-height: 1.5;
}

.gantt-richtext:empty::before {
  content: attr(placeholder);
  color: #94a3b8;
}

.gantt-richtext:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Progress Lock Badge */
.progress-lock-badge {
  font-size: 11px;
  color: #94a3b8;
  font-weight: normal;
  margin-left: 8px;
}

/* Attachment Styles */
.attachment-upload-wrapper {
  margin-bottom: 16px;
}

.btn-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}

.btn-upload:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #334155;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.attachment-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.attachment-icon {
  font-size: 20px;
}

.attachment-info {
  flex: 1;
  min-width: 0;
}

.attachment-name {
  display: block;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-name:hover {
  color: #3b82f6;
  text-decoration: underline;
}

.attachment-size {
  font-size: 11px;
  color: #94a3b8;
}

.attachment-delete {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #94a3b8;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
}

.attachment-item:hover .attachment-delete {
  opacity: 1;
}

.attachment-delete:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Context Menu */
.gantt-context-menu {
  position: fixed;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  padding: 6px 0;
  z-index: 1000;
}

.gantt-context-menu.hidden {
  display: none;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
}

.context-menu-item:hover {
  background: #f1f5f9;
}

.context-menu-item.danger {
  color: #ef4444;
}

.context-menu-item.danger:hover {
  background: #fef2f2;
}

.context-menu-separator {
  height: 1px;
  background: #e2e8f0;
  margin: 6px 0;
}

.context-menu-header {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.context-menu-accordion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 500;
}

.context-menu-accordion:hover {
  background: #f1f5f9;
}

.context-menu-accordion.expanded {
  background: #eff6ff;
  color: #2563eb;
}

.accordion-arrow {
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.2s;
}

.context-menu-accordion.expanded .accordion-arrow {
  color: #2563eb;
}

.context-menu-item.indent {
  padding-left: 28px;
  font-size: 13px;
  border-left: 2px solid #e2e8f0;
  margin-left: 12px;
}

.context-menu-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

/* ===== LIST VIEW STYLES ===== */

.list-view-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.list-view-header {
  display: flex;
  height: 44px;
  min-height: 44px;
  min-width: max-content;
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  position: sticky;
  top: 0;
  z-index: 3;
}

.list-view-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

.list-col {
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
  font-size: 11px;
}

.list-col-name {
  flex: 0 0 250px;
  min-width: 250px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

/* Header name column needs explicit background and higher z-index */
.list-view-header .list-col-name {
  background: var(--color-background);
  z-index: 4;
}
.list-col-status { width: 110px; }
.list-col-priority { width: 70px; }
.list-col-start { width: 90px; }
.list-col-end { width: 90px; }
.list-col-assignee { width: 70px; justify-content: center; }
.list-col-progress { width: 90px; gap: 6px; }
.list-col-tags { width: 100px; }
.list-col-hours { width: 60px; justify-content: center; }
.list-col-costs { width: 90px; justify-content: flex-end; font-size: 12px; }
.list-col-subtasks { width: 70px; justify-content: center; }
.list-col-actions { width: 50px; justify-content: center; }

/* Cost value colors */
.cost-positive { color: #22c55e; font-weight: 500; }
.cost-negative { color: #ef4444; font-weight: 500; }

/* Date and info columns - match Status font */
.list-col-start,
.list-col-end,
.list-col-hours,
.list-col-subtasks,
.list-col-assignee {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.list-row {
  display: flex;
  min-width: max-content;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.1s;
}

.list-row:hover {
  background: var(--color-background-hover);
}

.list-row.project-row {
  background: var(--color-surface-hover);
}

.list-row.project-row:hover {
  background: var(--color-background);
}

.list-row.milestone-row {
  background: #fff;
}

.list-row.task-row {
  background: #fff;
}

.row-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding-left: 12px;
}

.row-title {
  font-size: 13px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-title {
  font-style: italic;
  color: var(--color-text-secondary);
}

.project-icon {
  color: var(--color-primary);
  display: flex;
  align-items: center;
}

.milestone-icon {
  color: var(--color-accent);
  font-size: 10px;
}

.task-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.btn-collapse {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: background 0.1s, color 0.1s;
}

.btn-collapse:hover {
  background: var(--color-background-hover);
  color: var(--color-text);
}

.btn-collapse.invisible {
  visibility: hidden;
}

/* Progress Mini Bar */
.progress-mini {
  width: 50px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-mini-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.2s;
}

.progress-text {
  font-size: 11px;
  color: var(--color-text-secondary);
  min-width: 32px;
}

/* Status Dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.status-todo { background: #94a3b8; }
.status-dot.status-in_progress { background: #3b82f6; }
.status-dot.status-review { background: #8b5cf6; }
.status-dot.status-done { background: #22c55e; }
.status-dot.status-pending { background: #f59e0b; }

/* Priority badges */
.badge-priority-p1 { background: #fee2e2; color: #dc2626; }
.badge-priority-p2 { background: #fef3c7; color: #d97706; }
.badge-priority-p3 { background: #e0e7ff; color: #4f46e5; }
.badge-priority-p4 { background: #f1f5f9; color: #64748b; }

/* Avatar in list */
.list-col-assignee .avatar {
  font-size: 10px;
}

/* Gray Edit Button in List Actions */
.btn-edit-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: background 0.15s, transform 0.1s;
}

.btn-edit-action:hover {
  background: #e2e8f0;
  color: #3b82f6;
  transform: scale(1.05);
}

.btn-edit-action svg {
  width: 14px;
  height: 14px;
}

/* List View - Match font size with Status/Priority */
.list-view-body {
  font-size: 13px;
}

.list-col {
  font-size: 11px;
}

.row-title {
  font-size: 13px;
}

/* Drag handle in List view */
.list-row .drag-handle {
  display: flex;
  align-items: center;
  color: #94a3b8;
  cursor: grab;
  margin-right: 6px;
}

.list-row .drag-handle:hover {
  color: #64748b;
}

.list-row .drag-handle svg {
  width: 14px;
  height: 14px;
}

/* Drag handle aligned right for tasks/milestones */
.drag-handle-right {
  margin-left: auto;
  margin-right: 0;
  order: 99;
}

/* Tag mini badges */
.tag-mini {
  display: inline-block;
  padding: 2px 6px;
  background: #e2e8f0;
  color: #475569;
  border-radius: 4px;
  font-size: 10px;
  margin-right: 2px;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== Assignee Autocomplete (Outlook-style) ========== */
.assignee-autocomplete {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  min-height: 40px;
  cursor: text;
  transition: border-color 0.2s;
}

.assignee-autocomplete:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.assignee-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: #e2e8f0;
  color: #334155;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  animation: chipAppear 0.2s ease;
  border: 1px solid #cbd5e1;
}

@keyframes chipAppear {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.assignee-chip .chip-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #94a3b8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

.assignee-chip .chip-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  border: none;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.assignee-chip .chip-remove:hover {
  background: #94a3b8;
  color: #fff;
}

.assignee-autocomplete #assignee-input {
  flex: 1;
  min-width: 120px;
  border: none;
  outline: none;
  padding: 4px 0;
  font-size: 13px;
  background: transparent;
}

.assignee-autocomplete #assignee-input::placeholder {
  color: #94a3b8;
}

.assignee-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}

.assignee-dropdown.hidden {
  display: none;
}

.assignee-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.assignee-dropdown-item:hover,
.assignee-dropdown-item.highlighted {
  background: #f1f5f9;
}

.assignee-dropdown-item .dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.assignee-dropdown-item .dropdown-info {
  flex: 1;
}

.assignee-dropdown-item .dropdown-name {
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
}

.assignee-dropdown-item .dropdown-email {
  font-size: 11px;
  color: #64748b;
}

.assignee-dropdown-empty {
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.assignee-dropdown-create {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  cursor: pointer;
  color: #3b82f6;
  font-size: 13px;
  font-weight: 500;
}

.assignee-dropdown-create:hover {
  background: #eff6ff;
}

/* ========== List View Drag and Drop ========== */

.list-row.dragging {
  opacity: 0.5;
  background: #e0f2fe !important;
}

.list-row.drop-target-top {
  border-top: 2px solid #3b82f6 !important;
}

.list-row.drop-target-bottom {
  border-bottom: 2px solid #3b82f6 !important;
}

.list-row.drop-target-active {
  background: #eff6ff !important;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

/* ========== Avatar Stack ========== */

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar {
  border: 2px solid #fff;
  position: relative;
}

.avatar-more {
  background: #64748b !important;
  font-size: 9px !important;
}

/* ========== List Context Menu ========== */

.list-context-menu,
.context-submenu {
  position: fixed;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  padding: 6px 0;
  z-index: 10000;
}

.context-menu-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 6px 0;
}

.context-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #64748b;
}

.context-menu-icon svg {
  width: 14px;
  height: 14px;
}

.context-menu-label {
  flex: 1;
}

.context-menu-arrow {
  color: #94a3b8;
  font-size: 14px;
}

.context-menu-item.danger .context-menu-icon {
  color: #ef4444;
}

/* Priority badges P0 */
.badge-priority-p0 { 
  background: #fecaca; 
  color: #b91c1c; 
  font-weight: 600;
}
