/**
 * Task Modal Component - Unified ClickUp/Asana Style
 * Part of Mission Control Design System
 *
 * This provides a consistent task modal experience across all task types:
 * - ARC Tasks
 * - HD Cases
 * - Onboarding Tasks
 * - Partnership Tasks
 * - ProAction Tasks
 */

/* ==========================================
   MODAL OVERLAY & BACKDROP
   ========================================== */

.task-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

.task-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ==========================================
   MODAL CONTAINER
   ========================================== */

.task-modal-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================
   SLIDE-OVER PANEL LAYOUT
   ========================================== */

.task-modal-overlay.slide-over {
  justify-content: flex-end;
  align-items: stretch;
}

.task-modal-overlay.slide-over .task-modal-content {
  width: 560px;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  border-radius: 0;
  border-left: 1px solid var(--border-light);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.task-modal-overlay.slide-over.open .task-modal-content {
  transform: translateX(0);
}

/* Mobile: slide-over becomes full screen */
@media (max-width: 640px) {
  .task-modal-overlay.slide-over .task-modal-content {
    width: 100%;
    border-left: none;
  }
}

/* ==========================================
   MODAL HEADER - Clean Unified Style
   ========================================== */

.task-modal-header {
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: relative;
  min-height: auto;
  gap: var(--space-md);
}

.task-modal-header-left {
  flex: 1;
  min-width: 0;
}

.task-modal-header-badges {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.task-modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  word-break: break-word;
  cursor: text;
}

.task-modal-title:hover {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin: -2px -4px;
  padding: 2px 4px;
}

.task-modal-title-input {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  width: 100%;
  border: 1px solid var(--primary-blue);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  background: var(--bg-card);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.task-modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.task-modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* ==========================================
   METADATA ROW - Horizontal Chips
   ========================================== */

.task-metadata-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.metadata-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.metadata-chip:hover {
  border-color: var(--primary-blue-border);
  background: var(--primary-blue-light);
}

.metadata-chip-icon {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

.metadata-chip-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.metadata-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.metadata-chip-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.metadata-chip-value {
  font-weight: 500;
}

/* Timer chip - special styling */
.metadata-chip.timer-chip {
  gap: var(--space-sm);
  padding-left: 8px;
}

.timer-chip-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary-blue);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.timer-chip-btn:hover {
  background: var(--primary-blue-hover);
}

.timer-chip-btn.running {
  background: #DC2626;
}

.timer-chip-btn.running:hover {
  background: #B91C1C;
}

.timer-chip-time {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  font-weight: 600;
  font-size: 14px;
  min-width: 50px;
}

.timer-chip-total {
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: var(--space-xs);
  border-left: 1px solid var(--border-light);
  margin-left: var(--space-xs);
}

.timer-chip-info {
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.timer-chip-info:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* Due date chip - overdue state */
.metadata-chip.overdue {
  border-color: var(--error);
  background: var(--error-bg);
}

.metadata-chip.overdue .metadata-chip-value {
  color: var(--error);
}

/* Responsive metadata row */
@media (max-width: 640px) {
  .task-metadata-row {
    padding: var(--space-sm) var(--space-lg);
    gap: var(--space-xs);
  }

  .metadata-chip {
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* ==========================================
   MODAL BODY
   ========================================== */

.task-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
}

/* ==========================================
   DESCRIPTION SECTION
   ========================================== */

.task-description-section {
  margin-bottom: var(--space-lg);
}

.task-description-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-description-input {
  width: 100%;
  min-height: 240px;
  padding: var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  resize: vertical;
  transition: all var(--transition-base);
}

.task-description-input:hover {
  border-color: var(--border-light);
}

.task-description-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(31, 155, 255, 0.1);
}

.task-description-input::placeholder {
  color: var(--text-tertiary);
}

/* Description ASINs Row */
.description-asins-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.description-asins-row .asins-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.description-asins-row .asin-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--primary-blue-light);
  color: var(--primary-blue);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  cursor: pointer;
  transition: all 0.15s ease;
}

.description-asins-row .asin-badge:hover {
  background: var(--primary-blue);
  color: white;
}

/* ==========================================
   INFO CARDS GRID
   ========================================== */

.task-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
  .task-info-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.info-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.info-card p {
  margin: 0 0 var(--space-sm);
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.info-card p strong {
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 60px;
}

/* Due date picker */
.due-date-row {
  position: relative;
}

.due-date-display {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.due-date-display:hover {
  background: var(--bg-hover);
  color: var(--primary-blue);
}

.due-date-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* ==========================================
   SPECIALIST/ASSIGNEE DISPLAY
   ========================================== */

.specialist-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.specialist-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.specialist-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.specialist-title {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ==========================================
   CUSTOM DROPDOWN COMPONENTS
   ========================================== */

.custom-dropdown {
  position: relative;
}

.custom-dropdown-inline {
  display: inline-flex;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.dropdown-trigger:hover {
  background: var(--bg-hover);
}

.dropdown-chevron,
.dropdown-chevron-sm {
  transition: transform var(--transition-base);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.dropdown-chevron {
  width: 16px;
  height: 16px;
}

.dropdown-chevron-sm {
  width: 14px;
  height: 14px;
}

.custom-dropdown.open .dropdown-chevron,
.custom-dropdown.open .dropdown-chevron-sm {
  transform: rotate(180deg);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  max-height: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-base);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dropdown-panel-sm {
  min-width: 160px;
}

.custom-dropdown.open .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.dropdown-search input {
  flex: 1;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.dropdown-search input::placeholder {
  color: var(--text-tertiary);
}

.dropdown-options {
  overflow-y: auto;
  max-height: 250px;
  padding: var(--space-xs) 0;
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-option:hover {
  background: var(--bg-secondary);
}

.dropdown-option.selected {
  background: var(--primary-blue-light);
}

.dropdown-option-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.dropdown-option-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.dropdown-option-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.dropdown-option-email {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================
   STATUS & PRIORITY BADGES
   ========================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.status-queue { background: var(--bg-secondary); color: var(--text-secondary); }
.status-badge.status-in-progress { background: var(--info-bg); color: var(--info-text); }
.status-badge.status-pending { background: var(--warning-bg); color: var(--warning-text); }
.status-badge.status-scheduled { background: #EDE9FE; color: #7C3AED; }
.status-badge.status-complete { background: var(--success-bg); color: var(--success-text); }

.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.priority-badge.priority-standard { background: var(--bg-secondary); color: var(--text-secondary); }
.priority-badge.priority-high { background: var(--warning-bg); color: var(--warning-text); }
.priority-badge.priority-urgent { background: var(--error-bg); color: var(--error-text); }

/* Task type badges */
.task-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.task-type-badge.arc_task { background: #EDE9FE; color: #7C3AED; }
.task-type-badge.hd_case { background: #FEF3C7; color: #D97706; }
.task-type-badge.onboarding_task { background: #D1FAE5; color: #059669; }
.task-type-badge.partnership_task { background: #DBEAFE; color: #2563EB; }
.task-type-badge.proaction_task { background: #EDE9FE; color: #7C3AED; }

/* ==========================================
   FIELD ROW FOR INLINE EDITS
   ========================================== */

.field-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.field-row:last-child {
  margin-bottom: 0;
}

.field-row strong {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  min-width: 60px;
}

/* ==========================================
   DPM QUEUE INFO SECTION
   ========================================== */

.queue-info-section {
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius-md);
}

.queue-info-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  font-weight: 600;
  color: #7c3aed;
  margin-bottom: var(--space-md);
}

.queue-info-header svg {
  flex-shrink: 0;
}

.queue-info-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.queue-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.queue-info-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.queue-info-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

.queue-progress-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  max-width: 200px;
}

.queue-progress-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.queue-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6 0%, #7c3aed 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.queue-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.queue-info-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-sm);
  padding: 6px 12px;
  background: #7c3aed;
  color: white;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.2s ease;
  width: fit-content;
}

.queue-info-link:hover {
  background: #6d28d9;
  color: white;
}

.queue-info-link svg {
  flex-shrink: 0;
}

/* ==========================================
   DESCRIPTION SECTION
   ========================================== */

.task-description-section {
  margin-bottom: var(--space-xl);
}

.task-description-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.task-description {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  min-height: 60px;
}

.task-description.empty {
  color: var(--text-tertiary);
  font-style: italic;
}

/* ==========================================
   COLLAPSIBLE SECTIONS
   ========================================== */

.task-section {
  margin-bottom: var(--space-lg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.task-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-base);
}

.task-section-header:hover {
  background: var(--bg-tertiary);
}

.task-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.task-section-count {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.task-section-toggle {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  transition: transform var(--transition-base);
}

.task-section.collapsed .task-section-toggle {
  transform: rotate(-90deg);
}

.task-section-body {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
}

.task-section.collapsed .task-section-body {
  display: none;
}

/* ==========================================
   SUBTASKS SECTION
   ========================================== */

.subtasks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  transition: background var(--transition-base);
}

.subtask-item:hover {
  background: var(--bg-tertiary);
}

.subtask-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-medium);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.subtask-checkbox:hover {
  border-color: var(--primary-blue);
}

.subtask-item.completed .subtask-checkbox {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.subtask-title {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.subtask-item.completed .subtask-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.subtask-assignee {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  color: var(--text-secondary);
}

.subtask-assignee-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.subtask-assignee-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.subtask-due {
  font-size: 12px;
  color: var(--text-tertiary);
}

.subtask-due.overdue {
  color: var(--error);
  font-weight: 500;
}

.subtask-delete {
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-base);
}

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

.subtask-delete:hover {
  color: var(--error);
}

/* Subtask inline controls */
.subtask-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
}

.subtask-assignee-control,
.subtask-due-control {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
  min-width: 28px;
  height: 28px;
}

.subtask-assignee-control:hover,
.subtask-due-control:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.subtask-assignee-control .subtask-assignee-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.subtask-assignee-control .subtask-assignee-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.subtask-due-control span {
  font-size: 12px;
  white-space: nowrap;
}

.subtask-due-control.overdue {
  color: var(--error);
}

.subtask-due-control.overdue span {
  color: var(--error);
  font-weight: 500;
}

/* Fixed date picker for subtasks (appended to body) */
.subtask-date-picker-fixed {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}

/* Subtask assignee dropdown */
.subtask-assignee-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-height: 280px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.subtask-dropdown-search {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

.subtask-dropdown-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-secondary);
}

.subtask-dropdown-search input:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.subtask-dropdown-list {
  flex: 1;
  overflow-y: auto;
  max-height: 220px;
}

.subtask-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition-base);
  font-size: 13px;
}

.subtask-dropdown-item:hover {
  background: var(--bg-secondary);
}

.subtask-dropdown-item.selected {
  background: var(--primary-blue-light);
}

.subtask-dropdown-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.subtask-dropdown-avatar.unassigned {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.subtask-dropdown-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Add subtask input */
.add-subtask-form {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.add-subtask-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-card);
  transition: all var(--transition-base);
}

.add-subtask-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px var(--primary-blue-light);
}

.add-subtask-btn {
  padding: var(--space-sm) var(--space-md);
  background: var(--primary-blue-light);
  border: 1px solid var(--primary-blue-border);
  color: var(--primary-blue);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.add-subtask-btn:hover {
  background: rgba(31, 155, 255, 0.2);
}

/* Subtask progress bar */
.subtask-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.subtask-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.subtask-progress-fill {
  height: 100%;
  background: var(--success);
  transition: width var(--transition-base);
}

.subtask-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 50px;
  text-align: right;
}

/* HD Menu Dropdown for Subtasks */
.hd-menu-dropdown {
  position: relative;
}

.hd-menu-btn {
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.hd-menu-btn:hover {
  background: var(--bg-card);
  color: var(--primary-blue);
  border-color: var(--primary-blue-border);
}

.hd-menu-panel {
  display: none;
  position: fixed;
  width: 380px;
  min-height: 200px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10001;
  overflow: hidden;
}

.hd-menu-dropdown.open .hd-menu-panel {
  display: flex;
  flex-direction: column;
}

.hd-menu-search {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

.hd-menu-search input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-secondary);
}

.hd-menu-search input:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.hd-menu-list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
}


.hd-menu-category {
  border-bottom: 1px solid var(--border-light);
}

.hd-menu-category:last-child {
  border-bottom: none;
}

.hd-menu-category-header {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.hd-menu-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-base);
  border-bottom: 1px solid var(--border-ultra-light);
}

.hd-menu-item:last-child {
  border-bottom: none;
}

.hd-menu-item:hover {
  background: var(--bg-secondary);
}

.hd-menu-item-name {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.hd-menu-item-desc {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.hd-menu-empty {
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* Floating HD Menu Panel - appended to body to avoid transform issues in slide-over */
.hd-menu-panel-floating {
  display: none;
  position: fixed;
  width: 380px;
  min-height: 200px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100001;
  overflow: hidden;
  flex-direction: column;
}

.hd-menu-panel-floating .hd-menu-search {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

.hd-menu-panel-floating .hd-menu-search input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-secondary);
}

.hd-menu-panel-floating .hd-menu-search input:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.hd-menu-panel-floating .hd-menu-list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
}

/* ==========================================
   ATTACHMENTS SECTION
   ========================================== */

.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-sm);
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.attachment-item:hover {
  border-color: var(--primary-blue);
  background: var(--primary-blue-light);
}

.attachment-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attachment-icon.file { background: #FEE2E2; color: #DC2626; }
.attachment-icon.image { background: #D1FAE5; color: #059669; }
.attachment-icon.document { background: #DBEAFE; color: #2563EB; }
.attachment-icon.drive { background: #FEF3C7; color: #D97706; }

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

.attachment-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

.attachment-delete {
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-base);
}

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

.attachment-delete:hover {
  color: var(--error);
}

/* Add attachment buttons */
.add-attachment-row {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.add-attachment-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.add-attachment-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: var(--primary-blue-light);
}

/* Google Drive link input */
.drive-link-form {
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.drive-link-form.active {
  display: flex;
}

.drive-link-input {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.drive-link-input:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.drive-link-buttons {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ==========================================
   ACTIVITY & COMMENTS SECTION
   ========================================== */

.activity-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-md);
}

.activity-tab {
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-base);
}

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

.activity-tab.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}

/* Tab count badge */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.activity-tab.active .tab-count {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
}

/* Attachments tab content */
.attachments-tab-content {
  padding: var(--space-md) 0;
}

/* Comment input - always visible at top */
.comment-input-container {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.comment-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.comment-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-input-wrapper {
  flex: 1;
}

.comment-input {
  width: 100%;
  min-height: 40px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  resize: none;
  font-family: inherit;
  transition: all var(--transition-base);
}

.comment-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px var(--primary-blue-light);
  min-height: 80px;
}

.comment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-sm);
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: all var(--transition-base);
}

.comment-input:focus ~ .comment-actions,
.comment-actions.active {
  opacity: 1;
  height: auto;
  padding-top: var(--space-sm);
}

.comment-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.comment-submit-btn {
  padding: 6px 16px;
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.comment-submit-btn:hover {
  background: var(--primary-blue-hover);
}

.comment-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Activity/comment list */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.activity-item {
  display: flex;
  gap: var(--space-sm);
}

.activity-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
}

.activity-item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.activity-item-avatar.system {
  background: var(--bg-tertiary);
}

.activity-item-content {
  flex: 1;
  min-width: 0;
}

.activity-item-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 4px;
}

.activity-item-user {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-item-action {
  font-size: 13px;
  color: var(--text-secondary);
}

.activity-item-time {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.activity-item-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Clickable activity items */
.activity-item.clickable {
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  margin: 0 calc(-1 * var(--space-sm));
  border-radius: var(--radius-sm);
  transition: background var(--transition-base);
}

.activity-item.clickable:hover {
  background: var(--bg-secondary);
}

.activity-detail-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.activity-item.clickable:hover .activity-detail-icon {
  color: var(--primary-blue);
}

/* Activity Detail Popup */
.activity-detail-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100002;
  align-items: center;
  justify-content: center;
}

.activity-detail-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.activity-detail-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
}

.activity-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.activity-detail-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-detail-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-detail-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.activity-detail-body {
  padding: var(--space-lg);
}

.activity-detail-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.activity-detail-user {
  font-weight: 600;
  color: var(--text-primary);
}

.activity-detail-time {
  color: var(--text-tertiary);
  font-size: 13px;
}

.activity-detail-field {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.activity-detail-changes {
  display: flex;
  align-items: stretch;
  gap: var(--space-md);
}

.activity-detail-old,
.activity-detail-new {
  flex: 1;
  min-width: 0;
}

.activity-detail-old label,
.activity-detail-new label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.activity-detail-old .activity-detail-value {
  background: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger-text);
}

.activity-detail-new .activity-detail-value {
  background: var(--status-success-bg);
  border: 1px solid var(--status-success-border);
  color: var(--status-success-text);
}

.activity-detail-value {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 13px;
  word-break: break-word;
  min-height: 40px;
}

.activity-detail-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Comment-specific styles */
.comment-item {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.comment-item .activity-item-text {
  padding: var(--space-sm) 0;
}

.comment-actions-inline {
  display: flex;
  gap: var(--space-md);
  font-size: 12px;
}

.comment-action-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-base);
}

.comment-action-btn:hover {
  color: var(--primary-blue);
}

/* Show older button */
.show-older-container {
  text-align: center;
  padding: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.show-older-btn {
  padding: var(--space-sm) var(--space-lg);
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

.show-older-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
}

/* @mention dropdown */
.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  display: none;
  z-index: var(--z-dropdown);
}

.mention-dropdown.active {
  display: block;
}

.mention-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-base);
}

.mention-option:hover,
.mention-option.focused {
  background: var(--bg-secondary);
}

/* ==========================================
   WATCHERS SECTION
   ========================================== */

.watchers-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.watcher-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary-blue);
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: transform var(--transition-base);
  overflow: hidden;
}

.watcher-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.watcher-avatar:hover {
  transform: scale(1.1);
}

.add-watcher-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px dashed var(--border-medium);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.add-watcher-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: var(--primary-blue-light);
}

/* Watcher dropdown */
.watcher-dropdown {
  position: relative;
}

.watcher-dropdown-panel {
  position: absolute;
  top: auto;
  bottom: calc(100% + 8px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  min-width: 280px;
  max-height: 300px;
  overflow-y: auto;
}

.watcher-dropdown.open .watcher-dropdown-panel {
  transform: translateX(-50%) translateY(0);
}

/* Ensure modal footer doesn't clip dropdown */
.task-modal-footer {
  overflow: visible;
}

.modal-footer-left {
  overflow: visible;
}

.watchers-row {
  overflow: visible;
}

/* ==========================================
   MODAL FOOTER
   ========================================== */

.task-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.modal-footer-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.save-status {
  font-size: 13px;
  font-weight: 500;
}

.save-status.saving {
  color: var(--text-secondary);
}

.save-status.saved {
  color: var(--success);
}

.save-status.error {
  color: var(--error);
}

/* ==========================================
   EMPTY STATES
   ========================================== */

.empty-section {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
}

.empty-section svg {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.empty-section p {
  font-size: 14px;
  margin: 0;
}

/* ==========================================
   LOADING STATES
   ========================================== */

.section-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  gap: var(--space-sm);
  color: var(--text-tertiary);
  font-size: 14px;
}

.section-loading .loading-spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==========================================
   ACTIVITY/COMMENT DELETE BUTTONS
   ========================================== */

.activity-delete-btn {
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-base);
  margin-left: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.activity-item:hover .activity-delete-btn {
  opacity: 1;
}

.activity-delete-btn:hover {
  color: var(--error);
  background: var(--error-bg);
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 640px) {
  .task-modal-content {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .task-modal-header {
    padding: var(--space-md) var(--space-lg);
  }

  .task-modal-body {
    padding: var(--space-lg);
  }

  .task-info-grid {
    grid-template-columns: 1fr;
  }

  .attachments-grid {
    grid-template-columns: 1fr;
  }

  .comment-input-container {
    flex-direction: column;
  }

  .comment-user-avatar {
    align-self: flex-start;
  }

  .task-modal-footer {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
  }

  .modal-footer-left,
  .modal-footer-right {
    width: 100%;
    justify-content: center;
  }

  /* Always show delete buttons on mobile (no hover state) */
  .activity-delete-btn {
    opacity: 0.7;
  }
}

/* ==========================================
   TIME TRACKING STYLES
   ========================================== */

.time-tracking-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
}

.timer-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 16px;
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.timer-btn:hover {
  background: var(--primary-blue-hover);
}

.timer-btn.running {
  background: #DC2626;
}

.timer-btn.running:hover {
  background: #B91C1C;
}

.timer-display {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.timer-time {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.manual-time-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 12px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}

.manual-time-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Manual Time Form */
.manual-time-form {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.manual-time-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.manual-time-field {
  flex: 1;
}

.manual-time-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.manual-time-field input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 16px;
  text-align: center;
}

.manual-time-field input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px var(--primary-blue-light);
}

.manual-time-notes textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
  margin-bottom: var(--space-sm);
}

.manual-time-notes textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px var(--primary-blue-light);
}

.manual-time-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* Time Entries List */
.time-entries-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.time-entries-empty {
  text-align: center;
  padding: var(--space-lg);
  color: var(--text-tertiary);
  font-size: 13px;
}

.time-entry {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  position: relative;
}

.time-entry:hover .time-entry-delete {
  opacity: 1;
}

.time-entry-user {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.time-entry-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.time-entry-info {
  display: flex;
  flex-direction: column;
}

.time-entry-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.time-entry-date {
  font-size: 11px;
  color: var(--text-tertiary);
}

.time-entry-duration {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  padding: 4px 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.time-entry-notes {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--text-secondary);
  padding: var(--space-xs) 0 0 36px;
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-xs);
}

.time-entry-delete {
  opacity: 0;
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.time-entry-delete:hover {
  background: var(--error-bg);
  color: var(--error-text);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .time-tracking-controls {
    flex-wrap: wrap;
  }

  .manual-time-btn {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .timer-display {
    flex: 1;
  }

  .time-entry {
    grid-template-columns: auto 1fr auto;
  }

  .time-entry-delete {
    opacity: 0.7;
  }
}

/* ==========================================
   TIME TRACKING POPOVER
   ========================================== */

.time-tracking-popover {
  position: fixed;
  width: 380px;
  max-height: 450px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 10001;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.time-tracking-popover.open {
  display: flex;
}

.time-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.time-popover-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.time-popover-total {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.time-popover-close {
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.time-popover-close:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.time-popover-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.time-popover-add {
  padding: var(--space-md);
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.time-popover-add-btn {
  width: 100%;
  padding: 8px 16px;
  background: var(--primary-blue-light);
  border: 1px solid var(--primary-blue-border);
  color: var(--primary-blue);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: all var(--transition-base);
}

.time-popover-add-btn:hover {
  background: rgba(31, 155, 255, 0.2);
}

/* ==========================================
   ACTIVITY SECTION - ALWAYS VISIBLE
   ========================================== */

.task-section.always-visible .task-section-header {
  cursor: default;
}

.task-section.always-visible .task-section-toggle {
  display: none;
}

.task-section.always-visible .task-section-body {
  display: block !important;
}

/* Comments section header style */
.comments-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.comments-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ==========================================
   TASK DETAILS SECTION (Form Fields)
   ========================================== */

#utm-task-details-section .task-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-details-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  cursor: pointer;
}

.task-details-count {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.add-field-btn {
  background: transparent;
  border: 1px dashed var(--border-medium);
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-base);
  margin-top: var(--space-md);
}

.add-field-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: rgba(31, 155, 255, 0.05);
}

.task-details-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.task-details-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  padding: var(--space-sm) 0;
}

.task-detail-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  position: relative;
}

.task-detail-item:hover {
  border-color: var(--border-medium);
}

.task-detail-item:hover .task-detail-remove {
  opacity: 1;
}

.task-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 120px;
  flex-shrink: 0;
  padding-top: 2px;
}

.task-detail-value {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  transition: background var(--transition-base);
}

.task-detail-value:hover {
  background: var(--bg-tertiary);
}

.task-detail-value .empty-value {
  color: var(--text-muted);
  font-style: italic;
}

.task-detail-remove {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  opacity: 0;
  transition: all var(--transition-base);
}

.task-detail-remove:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Field value chips */
.field-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 12px;
  margin-right: 4px;
  margin-bottom: 2px;
}

.field-chip.asin-chip {
  background: rgba(31, 155, 255, 0.1);
  color: var(--primary-blue);
  font-family: monospace;
}

.field-chip.file-chip {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.field-link {
  color: var(--primary-blue);
  text-decoration: none;
  word-break: break-all;
}

.field-link:hover {
  text-decoration: underline;
}

/* ==========================================
   FIELD PICKER MODAL
   ========================================== */

.field-picker-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--z-modal) + 10);
}

.field-picker-modal.show {
  display: flex;
}

.field-picker-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
}

.field-picker-content {
  position: relative;
  width: 90%;
  max-width: 400px;
  max-height: 70vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.field-picker-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-picker-title,
.field-picker-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.field-picker-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.field-picker-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.field-picker-search {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.field-picker-search input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.field-picker-search input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(31, 155, 255, 0.1);
}

.field-picker-search input::placeholder {
  color: var(--text-muted);
}

.field-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.field-picker-item {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-base);
  margin-bottom: 2px;
}

.field-picker-item:hover {
  background: var(--bg-tertiary);
}

.field-picker-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.field-picker-item-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 2px;
}

.field-picker-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.field-picker-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ==========================================
   DUAL PANEL MODE - When ListingPanel Opens
   ========================================== */

/**
 * When ListingPanel opens while task modal is open,
 * the task modal shifts left to make room for side-by-side viewing.
 * This creates a split-panel UX similar to Notion/Linear.
 */

.task-modal-overlay.slide-over.shifted-for-listing .task-modal-content {
  /* Shift left by ListingPanel width (620px) */
  transform: translateX(-620px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-modal-overlay.slide-over.shifted-for-listing.open .task-modal-content {
  transform: translateX(-620px);
}

/* On smaller screens, stack vertically or reduce width */
@media (max-width: 1200px) {
  .task-modal-overlay.slide-over.shifted-for-listing .task-modal-content {
    /* Reduce task modal width to fit */
    width: calc(100vw - 620px - 20px);
    min-width: 320px;
    transform: translateX(-620px);
  }
}

@media (max-width: 900px) {
  /* On very small screens, let ListingPanel overlay */
  .task-modal-overlay.slide-over.shifted-for-listing .task-modal-content {
    width: 100%;
    transform: translateX(0);
  }
}

/* ==========================================
   TEAM ASSIGNMENT TOGGLE
   ========================================== */

/* Assignment mode toggle in dropdown */
.assignee-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.assignee-mode-toggle .mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: white;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.assignee-mode-toggle .mode-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.assignee-mode-toggle .mode-btn.active {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: white;
}

.assignee-mode-toggle .mode-btn svg {
  width: 14px;
  height: 14px;
}

/* Team avatar in dropdown */
.dropdown-option-avatar.team-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.dropdown-option-avatar.team-avatar svg {
  width: 14px;
  height: 14px;
}

/* Team badge indicator on the chip */
.team-badge-indicator {
  font-size: 10px;
  font-weight: 600;
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* When task is assigned to team, show team icon in avatar */
.metadata-chip-avatar svg {
  width: 14px;
  height: 14px;
}
