/* ==========================================================================
   VIEW 2: GHOST TREE EXPLORER & CENSUS (v5.6.0)
   Scoped to Ghost tree nodes, directory hierarchy, census, and inline creator.
   ========================================================================== */

.tree-explorer-header {
  background: #121212;
  border: 2px solid #151515;
  border-radius: 15px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ghost-tree-canvas {
  flex: 1;
  min-height: 0;
  background: #0e0e0e;
  border: 2px solid #151515;
  border-radius: 12px;
  padding: 8px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.ghost-tree-canvas.drag-target {
  border-color: var(--status-green-text) !important;
  background: rgba(52, 211, 153, 0.04) !important;
}

.ghost-tree-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ghost-tree-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s ease;
  font-family: var(--font-mono);
  font-size: 11px;
}

.ghost-tree-node:hover {
  background: var(--bg-surface-hover);
}

.ghost-tree-node.drag-target {
  background: rgba(52, 211, 153, 0.15) !important;
  outline: 1px dashed var(--status-green-text);
}

.ghost-tree-node.is-dragging {
  opacity: 0.35;
}

.ghost-tree-node.is-folder {
  font-weight: 600;
  color: #ffffff;
}

.ghost-tree-node.is-folder .expand-chevron {
  transition: transform 0.15s ease;
  color: var(--text-dim);
}

.ghost-tree-node.is-folder.open .expand-chevron {
  transform: rotate(90deg);
}

.ghost-tree-node.is-file {
  color: var(--text-main);
}

.ghost-tree-node .ghost-node-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-tree-node .ghost-tree-actions {
  display: none;
  gap: 4px;
  align-items: center;
}

.ghost-tree-node:hover .ghost-tree-actions,
.ghost-tree-node.is-selected .ghost-tree-actions {
  display: flex;
}

.ghost-tree-node.is-selected {
  background: rgba(255, 255, 255, 0.10);
  outline: 2px solid rgba(255, 255, 255, 0.55);
}

.ghost-tree-node:focus-visible {
  outline: 2px solid #8ab4f8;
  outline-offset: -2px;
}

@media (hover: none), (pointer: coarse) {
  .ghost-tree-node .ghost-tree-actions {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ghost-tree-node,
  .ghost-tree-node * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.ghost-tree-node {
  min-height: 24px;
}

.ghost-status-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 2px 4px;
}

.ghost-chip {
  background: #121212;
  border: 1px solid #222222;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.ghost-chip:hover {
  border-color: #383838;
  color: #ffffff;
}

.ghost-chip.active {
  background: #1f1f1f;
  border-color: #484848;
  color: #ffffff;
  font-weight: 600;
}

.ghost-chip-compact {
  margin-left: auto;
}

.ghost-folder-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
}

.ghost-folder-dot {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 0 4px;
  border-radius: 8px;
  line-height: 14px;
}

.ghost-folder-dot.modified {
  color: var(--status-green-text);
  background: rgba(52, 211, 153, 0.12);
}

.ghost-folder-dot.new {
  color: var(--status-blue-text);
  background: rgba(255, 255, 255, 0.08);
}

.ghost-folder-dot.tombstoned {
  color: var(--status-red-text);
  background: rgba(248, 113, 113, 0.12);
}

.btn-tree-extract {
  color: var(--status-green-text) !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
}

.btn-tree-extract:hover {
  background: rgba(52, 211, 153, 0.14) !important;
}

.ghost-tree-node.status-clean .file-icon { color: var(--text-dim); }
.ghost-tree-node.status-modified .file-icon { color: var(--status-green-text); }
.ghost-tree-node.status-new .file-icon { color: var(--status-blue-text); }
.ghost-tree-node.status-tombstone { color: var(--status-red-text); text-decoration: line-through; }
.ghost-tree-node.status-tombstone .file-icon { color: var(--status-red-text); }

.ghost-inline-create {
  background: rgba(52, 211, 153, 0.08);
  border: 1px dashed rgba(52, 211, 153, 0.4);
  padding: 3px 6px;
  gap: 6px;
}

.ghost-inline-input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  flex: 1;
  min-width: 0;
  padding: 0;
}

.ghost-inline-hints {
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.census-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.census-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

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

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-dot.clean { background: var(--text-dim); }
.legend-dot.modified { background: var(--status-green-text); }
.legend-dot.new { background: var(--status-blue-text); }
.legend-dot.tombstoned { background: var(--status-red-text); }

.deletions-list-viewport {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tombstone-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

details.legend-collapsible {
  cursor: default;
}
details.legend-collapsible > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.legend-collapsible > summary::-webkit-details-marker,
details.legend-collapsible > summary::marker {
  display: none;
}
details.legend-collapsible > summary::after {
  content: '+';
  float: right;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}
details[open].legend-collapsible > summary::after {
  content: '-';
}