.tree {
  position: relative;

  &:not(:first-child) {
    border-top: 1px solid var(--color-border-subtle);
  }
}

.tree-list {
  min-height: 128px;
}

.tree-header {
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background-color 300ms;
  cursor: pointer;
  padding: 4px 8px 4px 6px;

  &:hover {
    background: var(--color-control-bg-ghost-hover);
  }
}

.tree-header-arrow {
  transform: rotate(-90deg);
  transition: transform 200ms;
}

.tree-header-arrow-opened {
  transform: rotate(0);
}

.tree-header-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 24px;
}

.tree-count {
  display: flex;
}

.tree-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px 6px 6px;
  transition: background-color 300ms;
  gap: 4px;
  cursor: pointer;
  position: relative;

  &:hover {
    background: var(--color-control-bg-ghost-hover);
  }

  &:not(:first-child) {
    border-top: 1px solid var(--color-border-subtle);
  }
}
.tree-item-marked {
  background: var(--color-bg-secondary);
}

.item-title {
  display: flex;
}

.item-time {
  flex: none;
  margin-left: auto;
  color: var(--color-text-muted);
}

.test-count {
  display: flex;
  margin-left: auto;
}

.tree-content:not(.root) {
  display: block;
  padding-left: 24px;
  margin-bottom: 12px;
  border-top: 1px solid var(--color-border-subtle);
}

.tree-item-icon {
  padding: 2px 4px;
  height: max-content;
}

.status-passed {
  color: var(--color-status-passed-bg);
}

.status-failed {
  color: var(--color-status-failed-bg);
}

.status-broken {
  color: var(--color-status-broken-bg);
}

.status-skipped {
  color: var(--color-status-skipped-bg);
}

.status-unknown {
  color: var(--color-status-unknown-bg);
}

.tree-header-bar {
  display: inline-flex;
  align-items: center;
  gap: var(--space-0-25);
  font-family: var(--font-family);
  max-width: 140px;
  min-width: 46px;
  height: var(--space-2);
  background: transparent;
  margin-left: auto;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-s);
  overflow: visible;
}

.tree-header-bar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  text-align: center;
  padding: 0 var(--space-0-75);
  flex-grow: 1;

  &.passed {
    background-color: var(--color-status-passed-bg);
    color: var(--color-status-passed-on-bg);
  }

  &.failed {
    background-color: var(--color-status-failed-bg);
    color: var(--color-status-failed-on-bg);
  }

  &.broken {
    background-color: var(--color-status-broken-bg);
    color: var(--color-status-broken-on-bg);
  }

  &.skipped {
    background-color: var(--color-status-skipped-bg);
    color: var(--color-status-skipped-on-bg);
  }

  &.unknown {
    background-color: var(--color-status-unknown-bg);
    color: var(--color-status-unknown-on-bg);
  }
}

.tree-empty-results {
  padding: 44px 24px;
  text-align: center;
}

.tree-empty-results-title {
  color: var(--color-text-secondary);
}

.tree-empty-results-clear-button {
  margin-top: 4px;
}

.order {
  user-select: none;
  color: var(--color-text-muted);
  min-width: 16px;
  text-align: center;
  box-sizing: content-box;
  padding-top: 2px;
  line-height: 16px;
  width: 24px;
}
