:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --accent-primary: #3b82f6;
  --accent-secondary: #6366f1;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-block: #ef4444;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
}

.create-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.create-sidebar {
  width: 320px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: white;
}

.sidebar-header a {
  color: rgba(255,255,255,0.9);
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.sidebar-header a:hover {
  text-decoration: underline;
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
}

.form-group .required {
  color: #ef4444;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: all 0.2s;
  background: white;
  cursor: pointer;
  box-sizing: border-box;
}

.form-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group select:disabled {
  background: var(--bg-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: inherit;
  resize: vertical;
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 6px;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

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

.btn-success {
  background: var(--accent-success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-indigo {
  background: var(--accent-secondary);
  color: white;
}

.btn-indigo:hover {
  background: #4f46e5;
}

.btn-amber {
  background: #f59e0b;
  color: white;
}

.btn-amber:hover {
  background: #d97706;
}

.btn-purple {
  background: #8b5cf6;
  color: white;
}

.btn-purple:hover {
  background: #7c3aed;
}

.btn-danger {
  background: var(--accent-danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Block-specific button */
.btn-block {
  background: var(--accent-block);
  color: white;
}

.btn-block:hover {
  background: #dc2626;
}

.btn-submit {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

/* Toggle Switch Styles */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.toggle-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 80px;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  background: #e2e8f0;
  border-radius: 6px;
  padding: 2px;
}

.toggle-switch input {
  display: none;
}

.toggle-option {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  color: #64748b;
  user-select: none;
}

.toggle-option.active {
  background: white;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-option:hover:not(.active) {
  color: #475569;
}

/* Dynamic Allocation Styles */
.allocation-section {
  margin-bottom: 16px;
}

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

.allocation-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.allocation-add-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.allocation-add-btn:hover {
  background: #e2e8f0;
  color: #475569;
}

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

.allocation-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.allocation-item input {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.allocation-remove-btn {
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  transition: color 0.2s;
}

.allocation-remove-btn:hover {
  color: #ef4444;
}

/* Custom Fields Styles */
.custom-fields-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Custom Fields Card Layout */
.custom-field-row {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
}

.custom-field-row .cf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.custom-field-row .cf-header .cf-type {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: white;
}

.custom-field-row .cf-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-field-row .cf-body input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-sizing: border-box;
}

.custom-field-row .cf-delete-btn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.custom-field-row .cf-delete-btn:hover {
  background: #dc2626;
  color: white;
}

.custom-field-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-field-toggle-btn {
  width: 36px;
  height: 20px;
  background: #e2e8f0;
  border: none;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.custom-field-toggle-btn.active {
  background: #10b981;
}

.custom-field-toggle-btn::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;
}

.custom-field-toggle-btn.active::after {
  left: 18px;
}

.cf-boolean-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.cf-boolean-toggle span {
  font-size: 12px;
  color: #64748b;
}

.cf-boolean-hint {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

/* Global Custom Fields Styles */
.global-fields-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.global-field-row {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #bae6fd;
  position: relative;
}

.global-field-row .gf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.global-field-row .gf-header .gf-type {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid #7dd3fc;
  border-radius: 4px;
  background: white;
  color: #0369a1;
}

.global-field-row .gf-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.global-field-row .gf-body input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid #7dd3fc;
  border-radius: 4px;
  box-sizing: border-box;
}

.global-field-row .gf-delete-btn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.global-field-row .gf-delete-btn:hover {
  background: #dc2626;
  color: white;
}

.global-fields-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gf-boolean-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.gf-boolean-toggle span {
  font-size: 12px;
  color: #0369a1;
}

/* Predecessor/Successor Selection Styles */
.dependency-picker {
  margin-top: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: #fffbeb;
  border-radius: 8px;
  border: 1px solid #fcd34d;
}

.dependency-picker.hidden {
  display: none;
}

.dependency-picker-row {
  margin-bottom: 12px;
}

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

.dependency-picker-label {
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 6px;
  display: block;
}

.dependency-picker-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px dashed #fbbf24;
  border-radius: 6px;
  padding: 8px 12px;
  min-height: 36px;
}

.dependency-picker-box.has-selection {
  border-style: solid;
  border-color: #f59e0b;
  background: #fef3c7;
}

.dependency-picker-box .selected-item {
  flex: 1;
  font-size: 12px;
  color: #92400e;
  font-weight: 500;
}

.dependency-picker-box .selected-item.clickable-dep {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  transition: all 0.2s;
}

.dependency-picker-box .selected-item.clickable-dep:hover {
  color: #78350f;
  text-decoration-style: solid;
}

.dependency-picker-box .placeholder {
  flex: 1;
  font-size: 12px;
  color: #d97706;
  font-style: italic;
}

.dependency-picker-box .pick-btn {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.dependency-picker-box .pick-btn:hover {
  background: #d97706;
}

.dependency-picker-box .pick-btn.picking {
  background: #dc2626;
  animation: pulse-pick 1s infinite;
}

@keyframes pulse-pick {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.dependency-picker-box .clear-btn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dependency-picker-box .clear-btn:hover {
  background: #dc2626;
  color: white;
}

/* Canvas selection mode overlay */
.canvas-selection-mode {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: white;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  border-radius: 8px;
}

.canvas-selection-mode .cancel-selection {
  background: white;
  color: #d97706;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

/* WBS Grid picking mode styles */
.wbs-grid-container.picking-mode .wbs-grid-row[data-kind="block"],
.wbs-grid-container.picking-mode .wbs-grid-row[data-kind="activity"],
.wbs-grid-container.picking-mode .wbs-grid-row[data-kind="subActivity"] {
  background: #fffbeb !important;
  cursor: crosshair;
  border-left: 3px solid #f59e0b;
}

.wbs-grid-container.picking-mode .wbs-grid-row[data-kind="block"]:hover,
.wbs-grid-container.picking-mode .wbs-grid-row[data-kind="activity"]:hover,
.wbs-grid-container.picking-mode .wbs-grid-row[data-kind="subActivity"]:hover {
  background: #fef3c7 !important;
  box-shadow: 0 0 0 2px #f59e0b;
}

.predecessor-section {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.predecessor-section.hidden {
  display: none;
}

.predecessor-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

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

.predecessor-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.predecessor-row select {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.global-fields-section {
  margin-top: 16px;
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

.global-fields-title {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Main Canvas Area */
.create-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.main-toolbar {
  padding: 0.75rem 1rem;
  background: white;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main-toolbar h2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.main-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f0f4f8;
}

#mindmap-canvas {
  display: block;
  cursor: grab;
}

#mindmap-canvas:active {
  cursor: grabbing;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  color: #cbd5e1;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 300px;
}

/* Details Panel - In Sidebar */
.details-panel {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 1rem;
  overflow: hidden;
  display: none;
}

.details-panel.show {
  display: block;
}

.details-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.details-section:last-child {
  border-bottom: none;
}

.details-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.details-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.details-title {
  font-size: 14px;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.variable-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.variable-row input {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-family: monospace;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
}

.variable-row input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.variable-row .var-name {
  flex: 0.4;
}

.variable-row .var-ref {
  flex: 0.6;
}

.variable-row .delete-var-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.variable-row .delete-var-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

.add-variable-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
  border: 1px dashed var(--accent-primary);
  border-radius: 6px;
  cursor: pointer;
  margin-top: 4px;
}

.add-variable-btn:hover {
  background: rgba(59, 130, 246, 0.2);
}

.operator-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.operator-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: monospace;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
}

.operator-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.block-actions-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
}

.action-group-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.action-group .action-buttons {
  margin-top: 0;
}

code {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  color: var(--accent-primary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
}

.status-badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.connected-info {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 6px;
  padding: 10px;
  margin-top: 10px;
}

.connected-info-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-success);
  margin-bottom: 6px;
}

.connected-node {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 3px 0;
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* View Mode Toggle */
.view-toggle {
  display: flex;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.view-toggle-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--accent-primary);
  color: white;
}

/* WBS Grid View Styles */
.wbs-grid-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wbs-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.wbs-grid-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  max-width: 280px;
  min-width: 120px;
}

.wbs-grid-title:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
}

.wbs-grid-title.title-selected {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.wbs-grid-title.title-selected:hover {
  background: rgba(139, 92, 246, 0.15);
}

.wbs-grid-title-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.wbs-grid-title-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wbs-grid-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.wbs-grid-search input {
  width: 100%;
  padding: 8px 110px 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-sizing: border-box;
}

.wbs-grid-search input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.wbs-grid-search-controls {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-count {
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.search-nav-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
}

.search-nav-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.search-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wbs-grid-actions {
  display: flex;
  gap: 8px;
}

.wbs-grid-action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
}

.wbs-grid-action-btn:hover {
  background: var(--bg-tertiary);
}

.wbs-grid-columns {
  display: grid;
  grid-template-columns: 90px 2.2fr 1.2fr 100px 1.4fr;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.wbs-grid-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.wbs-grid-body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.wbs-grid-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
}

.wbs-grid-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
}

.wbs-grid-row {
  display: grid;
  grid-template-columns: 90px 2.2fr 1.2fr 100px 1.4fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  align-items: start;
  transition: background 0.15s;
  cursor: pointer;
}

.wbs-grid-row:hover {
  background: rgba(59, 130, 246, 0.04);
}

.wbs-grid-row.row-hit {
  background: rgba(59, 130, 246, 0.1);
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.wbs-grid-row.row-selected {
  background: rgba(139, 92, 246, 0.08);
  box-shadow: inset 0 0 0 2px rgba(139, 92, 246, 0.4);
}

.wbs-grid-row.row-selected:hover {
  background: rgba(139, 92, 246, 0.12);
}

/* Constants Section */
.wbs-constants-section {
  border-top: 2px solid var(--border-color);
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  max-height: 400px;
  overflow: hidden;
  flex-shrink: 0;
}

.wbs-constants-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.04) 100%);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  flex-shrink: 0;
}

.wbs-constants-header:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.08) 100%);
}

.wbs-constants-toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-success);
  transition: transform 0.2s;
}

.wbs-constants-toggle.collapsed {
  transform: rotate(-90deg);
}

.wbs-constants-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-success);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wbs-constants-badge {
  background: var(--accent-success);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.wbs-constants-columns {
  display: grid;
  grid-template-columns: 140px 1.5fr 1fr 80px 120px;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(16, 185, 129, 0.04);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.wbs-constants-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.wbs-constants-body.collapsed {
  display: none;
}

.wbs-constant-row {
  display: grid;
  grid-template-columns: 140px 1.5fr 1fr 80px 120px;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  transition: background 0.15s;
  cursor: pointer;
}

.wbs-constant-row:hover {
  background: rgba(16, 185, 129, 0.04);
}

.wbs-constant-row.row-selected {
  background: rgba(139, 92, 246, 0.08);
  box-shadow: inset 0 0 0 2px rgba(139, 92, 246, 0.4);
}

.wbs-constant-row.row-selected:hover {
  background: rgba(139, 92, 246, 0.12);
}

.wbs-constant-id {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--accent-success);
  font-weight: 500;
}

.wbs-constant-name {
  font-size: 13px;
  color: var(--text-primary);
}

.wbs-constant-value {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.wbs-constant-uom {
  font-size: 12px;
  color: var(--text-secondary);
}

.wbs-constant-source {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wbs-constant-copy {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.wbs-constant-copy:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
}

.wbs-constants-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.wbs-constants-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--accent-success);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  border-top: 1px dashed var(--border-color);
  flex-shrink: 0;
}

.wbs-constants-add:hover {
  background: rgba(16, 185, 129, 0.06);
}

.wbs-grid-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.wbs-cell-wbs {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-size: 13px;
}

.wbs-cell-excel {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.wbs-cell-indent {
  flex-shrink: 0;
}

.wbs-caret-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.wbs-caret-btn:hover {
  background: var(--bg-tertiary);
}

.wbs-caret-placeholder {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.wbs-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid;
}

/* Block badge - RED */
.wbs-type-badge.badge-block {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.3);
}

.wbs-type-badge.badge-activity {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}

.wbs-type-badge.badge-sub {
  background: rgba(236, 72, 153, 0.1);
  color: #db2777;
  border-color: rgba(236, 72, 153, 0.3);
}

.wbs-type-badge.badge-child {
  background: rgba(6, 182, 212, 0.1);
  color: #0891b2;
  border-color: rgba(6, 182, 212, 0.3);
}

.wbs-excel-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

.wbs-cell-task {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}

.wbs-cell-area {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.wbs-cell-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.wbs-material-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 11px;
  max-width: 180px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.wbs-material-chip:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
}

.wbs-material-chip .mat-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wbs-material-chip .mat-qty {
  padding: 2px 6px;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-radius: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.wbs-view-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
}

.wbs-view-more-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.term-hit {
  background: #fde047;
  color: #111827;
  border-radius: 4px;
  padding: 0 2px;
}

/* Materials Modal */
.materials-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.materials-modal {
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.materials-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.materials-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.materials-modal-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.materials-modal-close {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
}

.materials-modal-close:hover {
  background: var(--bg-tertiary);
}

.materials-modal-content {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.material-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.material-card:hover {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.3);
}

.material-card-info {
  min-width: 0;
}

.material-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.material-card-uom {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.material-card-qty {
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.zoom-btn:hover {
  background: var(--border-color);
}

.zoom-level {
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 50px;
  justify-content: center;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-overlay.show {
  display: flex;
}

.loading-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  max-width: 320px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.loading-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Stats Panel */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 1rem;
}

.stat-item {
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Material Analysis Section */
.material-analysis {
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.material-analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(234, 88, 12, 0.04) 100%);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.material-analysis-header:hover {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12) 0%, rgba(234, 88, 12, 0.08) 100%);
}

.material-analysis-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #f97316;
}

.material-analysis-toggle {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f97316;
  transition: transform 0.2s;
}

.material-analysis-toggle.collapsed {
  transform: rotate(-90deg);
}

.material-analysis-body {
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid var(--border-color);
}

.material-analysis-body.collapsed {
  display: none;
}

.material-analysis-body::-webkit-scrollbar {
  width: 6px;
}

.material-analysis-body::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.3);
  border-radius: 3px;
}

.material-analysis-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.material-analysis-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.material-analysis-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.1s;
}

.material-analysis-item:last-child {
  border-bottom: none;
}

.material-analysis-item:hover {
  background: rgba(249, 115, 22, 0.04);
}

.material-analysis-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.material-analysis-qty {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
}

.material-analysis-value {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #f97316;
}

.material-analysis-unit {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.material-analysis-count {
  background: #f97316;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 4px;
}

/* ===========================================
   Drag and Drop Styles
   =========================================== */

/* Grid row dragging state */
.wbs-grid-row.dragging {
  opacity: 0.5;
  background: #e0e7ff !important;
}

/* Grid row drop target state */
.wbs-grid-row.drop-target {
  background: #dcfce7 !important;
  box-shadow: inset 0 0 0 2px #22c55e;
}

/* Make draggable rows show grab cursor */
.wbs-grid-row[draggable="true"] {
  cursor: grab;
}

.wbs-grid-row[draggable="true"]:active {
  cursor: grabbing;
}

/* Drag ghost element */
.drag-ghost {
  background: white;
  border: 2px solid #6366f1;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
}

.drag-ghost-block {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.drag-ghost-activity {
  border-color: #10b981;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.drag-ghost-subActivity,
.drag-ghost-nestedSubActivity {
  border-color: #ec4899;
  background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
}

/* ===== Multi-Pick Mode Styles ===== */

/* Multi-pick overlay bar */
.multi-pick-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #10b981, #059669);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.multi-pick-overlay .pick-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.multi-pick-overlay .pick-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.875rem;
}

.multi-pick-overlay .pick-actions {
  display: flex;
  gap: 12px;
}

.multi-pick-overlay .done-selection {
  background: white;
  color: #059669;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.multi-pick-overlay .done-selection:hover {
  background: #f0fdf4;
  transform: translateY(-1px);
}

.multi-pick-overlay .cancel-selection {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.multi-pick-overlay .cancel-selection:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
}

/* Grid row multi-pick selected state */
.wbs-grid-row.multi-pick-selected {
  background: rgba(16, 185, 129, 0.1) !important;
  box-shadow: inset 0 0 0 2px #10b981;
}

.wbs-grid-row.multi-pick-current {
  background: rgba(239, 68, 68, 0.1) !important;
  box-shadow: inset 0 0 0 2px #ef4444;
}

/* Predecessor chips container */
.predecessor-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.predecessor-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 16px;
  font-size: 0.8125rem;
  color: #92400e;
}

.predecessor-chip .chip-name {
  cursor: pointer;
}

.predecessor-chip .chip-name:hover {
  text-decoration: underline;
}

.predecessor-chip .chip-remove {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  padding: 0 2px;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
}

.predecessor-chip .chip-remove:hover {
  opacity: 1;
}

/* Group dependency chip (FINISH_OF_SUBTREE) */
.predecessor-chip.chip-group {
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  border: 1px solid #3b82f6;
  color: #1e40af;
}

.predecessor-chip.chip-group .chip-name {
  font-weight: 500;
}

.predecessor-chip.chip-group .chip-remove {
  color: #3b82f6;
}

/* Specific task dependency chip (SPECIFIC_TASK) */
.predecessor-chip.chip-task {
  background: #fef3c7;
  border: 1px solid #d97706;
  color: #92400e;
}

/* ========================================
   PREDECESSOR DETAILS SECTION
   ======================================== */

.predecessor-details-section {
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.predecessor-details-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s ease;
}

.predecessor-details-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.predecessor-details-header .collapse-icon {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.predecessor-details-header.expanded .collapse-icon {
  transform: rotate(90deg);
}

.predecessor-details-header .predecessor-count {
  margin-left: auto;
  background: var(--accent-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.predecessor-details-content {
  border-top: 1px solid var(--border-color);
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.predecessor-detail-item {
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: white;
  border: 1px solid var(--border-color);
}

.predecessor-detail-item:last-child {
  margin-bottom: 0;
}

.predecessor-detail-item.scope-group {
  border-left: 3px solid #3b82f6;
}

.predecessor-detail-item.scope-task {
  border-left: 3px solid #d97706;
}

.predecessor-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.predecessor-detail-name {
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.predecessor-detail-name:hover {
  text-decoration: underline;
  color: var(--accent-primary);
}

.predecessor-detail-scope {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.predecessor-tree-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.predecessor-tree-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.predecessor-tree-toggle .tree-icon {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.predecessor-tree-toggle.expanded .tree-icon {
  transform: rotate(90deg);
}

.predecessor-tree-content {
  margin-top: 8px;
  padding-left: 8px;
  border-left: 2px solid var(--border-color);
}

.descendant-tree-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8125rem;
}

.descendant-tree-list .descendant-tree-list {
  margin-left: 16px;
  margin-top: 4px;
}

.descendant-tree-item {
  padding: 4px 0;
  color: var(--text-secondary);
}

.tree-node-name {
  cursor: pointer;
}

.tree-node-name:hover {
  text-decoration: underline;
  color: var(--accent-primary);
}

.tree-ellipsis {
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

.add-predecessor-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  transition: all 0.2s;
}

.add-predecessor-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* Eye icon for dependency visualization */
.dep-eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.dep-eye-btn:hover {
  color: #3b82f6;
}

/* Dependency header row */
.dependency-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

/* Dependency view button */
.dep-eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.dep-eye-btn:hover {
  color: #3b82f6;
}

/* Dependency header row */
.dependency-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.dependency-header-row label {
  margin: 0;
}

/* ===== Dependency View Mode Styles ===== */

body.dependency-view-active .main-toolbar {
  pointer-events: none;
  opacity: 0.5;
}

body.dependency-view-active .create-sidebar {
  pointer-events: auto;
  opacity: 1;
}

.dependency-view-overlay {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: auto !important;
}

.exit-dependency-view {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 14px 28px;
  border: 2px solid white;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.exit-dependency-view:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.6);
}

.exit-dependency-view svg {
  flex-shrink: 0;
}

/* ===========================================
   Activity Picker Modal (for importing from template)
   =========================================== */

.activity-picker-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 20px;
}

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

.activity-picker-content {
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.activity-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.04) 100%);
}

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

.activity-picker-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
}

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

.activity-picker-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.activity-picker-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.activity-picker-search input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.activity-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.activity-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.activity-picker-item:hover {
  background: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.3);
}

.activity-picker-item.selected {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--accent-success);
  box-shadow: inset 0 0 0 2px var(--accent-success);
}

.activity-picker-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: white;
}

.activity-picker-item.selected .activity-picker-checkbox {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: white;
}

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

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

.activity-picker-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.activity-picker-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
  flex-shrink: 0;
}

.activity-picker-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.activity-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

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

.activity-picker-count strong {
  color: var(--accent-success);
}

.activity-picker-actions {
  display: flex;
  gap: 10px;
}

/* ===========================================
   Template Import Section (when block is selected)
   =========================================== */

.template-import-section {
  margin-top: 16px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
}

.template-import-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-import-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-import-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
}

.template-import-btn:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent-primary);
}

.template-import-btn svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.template-import-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Template not selected warning */
.template-warning {
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  font-size: 12px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-warning svg {
  flex-shrink: 0;
  color: #f59e0b;
}

/* ========================================
   DEPENDENCY CHOICE MODAL
   ======================================== */
.dependency-choice-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10001;
  align-items: center;
  justify-content: center;
}

.dependency-choice-modal.show {
  display: flex;
}

.dependency-choice-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 480px;
  width: 90%;
  animation: depModalSlideIn 0.3s ease-out;
}

@keyframes depModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dependency-choice-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.dependency-choice-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d97706;
}

.dependency-choice-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

.dependency-choice-body {
  padding: 20px 24px;
}

.dependency-choice-message {
  margin: 0 0 16px;
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}

.dependency-choice-details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
}

.dependency-choice-details strong {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dependency-activities-list {
  margin: 8px 0 0;
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.4;
}

.dependency-choice-options {
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dep-choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  background: #f8fafc;
}

.dep-choice-btn:hover {
  transform: translateY(-1px);
}

.dep-choice-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dep-choice-btn-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dep-choice-btn-text strong {
  font-size: 14px;
  font-weight: 600;
}

.dep-choice-btn-text span {
  font-size: 12px;
  color: #64748b;
}

/* Include All button */
.dep-choice-include {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #86efac;
}

.dep-choice-include:hover {
  border-color: #22c55e;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.dep-choice-include .dep-choice-btn-icon {
  background: #22c55e;
  color: white;
}

.dep-choice-include .dep-choice-btn-text strong {
  color: #166534;
}

/* Clear Dependencies button */
.dep-choice-clear {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #fcd34d;
}

.dep-choice-clear:hover {
  border-color: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.dep-choice-clear .dep-choice-btn-icon {
  background: #f59e0b;
  color: white;
}

.dep-choice-clear .dep-choice-btn-text strong {
  color: #92400e;
}

/* Cancel/Go Back button */
.dep-choice-cancel {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.dep-choice-cancel:hover {
  border-color: #94a3b8;
  background: #e2e8f0;
}

.dep-choice-cancel .dep-choice-btn-icon {
  background: #64748b;
  color: white;
}

.dep-choice-cancel .dep-choice-btn-text strong {
  color: #475569;
}

/* ===== Swap Dependency Dialog ===== */
.swap-place-dialog-overlay {
  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: 10000;
  animation: swapDialogFadeIn 0.15s ease;
}

@keyframes swapDialogFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.swap-place-dialog {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: swapDialogSlideUp 0.2s ease;
}

@keyframes swapDialogSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.swap-place-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.swap-place-message {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.swap-place-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.swap-place-buttons .btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  justify-content: center;
}

.swap-place-buttons .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.swap-place-buttons .btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.swap-place-buttons .btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.swap-place-buttons .btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.swap-place-buttons .btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.swap-place-buttons .btn-secondary:hover {
  background: var(--border-color);
}
