/* Дерево разделов «Предметов» — список категорий: раздел, группа, тип, у каждого число вещей.
   Выбранный узел — золотом с чертой слева. Прилипает под логотипом; уже 900 выезжает слева поверх страницы. */

.items-tree {
  position: sticky;
  top: var(--items-sticky-top);
  max-height: calc(100vh - var(--items-sticky-top) - var(--space-3));
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}

.items-tree__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2) var(--space-2);
  font-family: var(--font-accent);
  font-size: 1.125rem;
}

.items-tree__close {
  display: none;
  padding: var(--space-1);
  color: var(--color-text);
  background: none;
  border: 0;
  cursor: pointer;
}

.items-tree__svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.items-tree__row {
  display: flex;
  align-items: center;
}

.items-tree__node {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-2);
  font: inherit;
  text-align: left;
  color: var(--color-text);
  background: none;
  border: 0;
  border-left: var(--accent-line) solid transparent;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: background-color var(--speed-fast) var(--ease);
}

.items-tree__node:hover {
  background: var(--color-hover);
}

.items-tree__node.is-active {
  color: var(--color-accent-light);
  background: var(--color-accent-soft);
  border-left-color: var(--color-accent);
}

.items-tree__node--d1 {
  padding-left: calc(var(--space-4) - var(--accent-line));
}

.items-tree__node--d2 {
  padding-left: calc(var(--space-4) + var(--space-3));
}

.items-tree__icon {
  width: var(--items-tree-icon);
  height: var(--items-tree-icon);
  flex: none;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7);
}

.items-tree__label {
  flex: 1;
  min-width: 0;
  /* Перенос в имени вида держится: «Мифическое / оружие» в две строки (автор, 2026-10-03). */
  white-space: pre-line;
}

.items-tree__count {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.items-tree__chevron {
  flex: none;
  padding: var(--space-1);
  color: var(--color-text-muted);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: transform var(--speed-fast) var(--ease);
}

.items-tree__chevron:hover {
  color: var(--color-text);
  background: var(--color-hover);
}

.items-tree__chevron.is-open {
  transform: rotate(90deg);
}

.items-tree__group {
  padding: var(--space-2) var(--space-2) 2px var(--space-4);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .items-tree {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(var(--items-drawer-width), 88vw);
    max-height: none;
    border-radius: 0;
    background: var(--color-surface-strong);
    transform: translateX(-100%);
    transition: transform var(--speed) var(--ease);
  }

  .items-tree.is-open {
    transform: none;
  }

  .items-tree__close {
    display: block;
  }
}
