/* ------------------------------------------------------------
   14 · TREE / TABLE / LIST
   ------------------------------------------------------------ */
/* A list is a tree without folding — same row metrics, hover, selection,
   no per-row rules, no container chrome. Just a plain stack like .dcs-tree. */
.dcs-list {
  display: flex; flex-direction: column;
  user-select: none;
}
/* Lists and trees are the same primitive — identical row metrics, hover, and
   selection. A tree row just adds depth indent + a chevron. Both are
   density-driven (height = --dcs-h), so sm/md/lg read clearly and match. */
.dcs-list__item,
.dcs-tree__row {
  display: flex; align-items: center;
  position: relative;          /* drop-indicator lines hang off ::before/::after */
  height: var(--dcs-h);
  /* .dcs-list is a flex column; without this its rows shrink below --dcs-h
     when the list overflows/scrolls, breaking parity with tree rows (which
     live in a plain block). Lock both to exactly --dcs-h. */
  flex: 0 0 var(--dcs-h);
  box-sizing: border-box;
  font-size: var(--dcs-fs-sm);
  color: var(--dcs-text-dim);
  cursor: default;
  user-select: none;
}
/* Drag-to-reorder: grab affordance + a 2px accent drop-indicator line
   (before/after a row) or an inset highlight for drop-into (reparent). */
.dcs-list__item--draggable, .dcs-tree__row--draggable { cursor: grab; }
.dcs-list__item--draggable:active, .dcs-tree__row--draggable:active { cursor: grabbing; }
.dcs-list__item--drop-before::before, .dcs-tree__row--drop-before::before,
.dcs-list__item--drop-after::after,  .dcs-tree__row--drop-after::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px;
  background: var(--dcs-accent); z-index: 3; pointer-events: none;
}
.dcs-list__item--drop-before::before, .dcs-tree__row--drop-before::before { top: -1px; }
.dcs-list__item--drop-after::after,   .dcs-tree__row--drop-after::after  { bottom: -1px; }
.dcs-list__item--drop-into, .dcs-tree__row--drop-into {
  background: var(--dcs-accent-dim);
  box-shadow: inset 0 0 0 1px var(--dcs-accent);
}

/* Typed drop-target affordance (DnD framework) — a target the dragged type
   is valid for vs one it isn't. Applied by useDrop / DropZone / data-dcs-drop. */
.dcs-drop--valid { box-shadow: inset 0 0 0 2px var(--dcs-accent); }
.dcs-drop--invalid { box-shadow: inset 0 0 0 2px var(--dcs-danger); cursor: no-drop; }
/* No per-line rule — matches the tree's left inset so the two read alike. */
.dcs-list__item { gap: var(--dcs-s-2); padding: 0 var(--dcs-s-4) 0 var(--dcs-s-2); }
.dcs-tree { user-select: none; }
.dcs-tree__row {
  gap: 2px;
  padding-left: calc(var(--dcs-s-2) + var(--depth, 0) * 14px);
  padding-right: var(--dcs-s-4);
}
.dcs-list__item:hover,
.dcs-tree__row:hover { background: var(--dcs-surface-1); color: var(--dcs-text); }
/* Collapsing a tree branch hides descendant rows via `[hidden]`. Override
   the default class-driven `display: flex` so the hidden state wins. */
.dcs-list__item[hidden],
.dcs-tree__row[hidden] { display: none; }
.dcs-list__item[aria-selected="true"],
.dcs-tree__row[aria-selected="true"] {
  background: var(--dcs-accent-dim);
  color: var(--dcs-text);
  box-shadow: inset 2px 0 0 var(--dcs-accent);
}
.dcs-tree__chevron {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--dcs-text-mute);
  transition: transform var(--dcs-t-fast);
}
.dcs-tree__chevron--open { transform: rotate(90deg); }
.dcs-tree__icon { width: 14px; height: 14px; color: var(--dcs-text-mute); flex: 0 0 auto; }
.dcs-tree__row[aria-selected="true"] .dcs-tree__icon { color: var(--dcs-accent); }
.dcs-tree__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcs-tree__meta { color: var(--dcs-text-mute); font-family: var(--dcs-font-mono); font-size: var(--dcs-fs-xs); }

.dcs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--dcs-fs-sm);
  background: var(--dcs-bg);
}
.dcs-table th {
  text-align: left;
  font-weight: 500;
  font-size: var(--dcs-fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dcs-text-mute);
  padding: var(--dcs-s-3) var(--dcs-s-4);
  background: var(--dcs-surface-1);
  border-bottom: 1px solid var(--dcs-line);
  position: sticky; top: 0;
}
.dcs-table td {
  padding: var(--dcs-s-3) var(--dcs-s-4);
  border-bottom: 1px solid var(--dcs-line-soft);
  color: var(--dcs-text-dim);
}
.dcs-table tbody tr:hover td { background: var(--dcs-surface-1); color: var(--dcs-text); }
.dcs-table tbody tr[aria-selected="true"] td { background: var(--dcs-accent-dim); color: var(--dcs-text); }
.dcs-table--mono td:nth-child(n+2) { font-family: var(--dcs-font-mono); font-variant-numeric: tabular-nums; }
