/* The note tree: dense rows, chevrons, coloured icons, separators, drop indicators. */
.tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--row-h);
  padding: 0 var(--sp-3) 0 calc(var(--sp-2) + var(--depth, 0) * 16px);
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.row:hover {
  background: var(--surface-3);
  color: var(--text);
}

.row[aria-selected="true"] {
  background: var(--select);
  color: var(--text);
}

.row.is-open .title {
  color: var(--text);
  font-weight: 500;
}

.tree:focus-within .row.is-cursor {
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.row .chev {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-3);
  border-radius: 4px;
  transition: transform var(--t-fast) var(--ease-out);
}

.row .chev .i {
  width: 13px;
  height: 13px;
}

.row[aria-expanded="true"] .chev {
  transform: rotate(90deg);
}

.row:not([aria-expanded]) .chev {
  visibility: hidden;
}

.row .ico {
  color: var(--ic, var(--text-3));
}

.row .title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .meta {
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.row .rename {
  flex: 1;
  min-width: 0;
  height: 22px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  background: var(--surface-2);
  outline: none;
}

.ftype {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 16px;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--ic, var(--ic-red));
  color: var(--surface-0);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Labelled separator, e.g. "Done". */
.row.sep {
  height: 22px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.row.sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}

.row.sep .title {
  flex: none;
}

/* the arrow is drawn 5px inside the chevron box: the label's first letter starts where the arrow does */
.row.sep .title {
  padding-left: 6px;
}

/* Drag and drop */
.row.drop-inside {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.row.drop-before::before,
.row.drop-after::before {
  content: "";
  position: absolute;
  left: calc(var(--sp-2) + var(--depth, 0) * 16px + 20px);
  right: var(--sp-3);
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.row.drop-before::before {
  top: -1px;
}

.row.drop-after::before {
  bottom: -1px;
}

.row.is-dragging {
  opacity: 0.45;
}

/* The cursor row shows focus; the list itself needs no ring. */
.tree:focus-visible {
  outline: none;
}

/* Room under the last row to drop files at the end of the workspace. */
#tree {
  min-height: 64px;
  padding-bottom: var(--sp-8);
}
