.tree {
    position: relative;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 1s ease-in;
    --spacing : 1.9rem;
    --radius  : 10px;
    --padding : 0.0rem;
}

.root {
    margin-left: 25px;
    padding: 1rem 0.5rem;
    line-height: var(--spacing);
}

.caret {
    cursor: pointer;
    font-weight: bold;
    -webkit-user-select: none; /* Safari 3.1+ */
    -moz-user-select: none; /* Firefox 2+ */
    -ms-user-select: none; /* IE 10+ */
    user-select: none;
}

.item {
    position: relative;
    cursor: pointer;
}

.item, .caret {
    text-align: left;
}

.item a, .caret a {
    text-decoration: none;
    color: black;
}

.itemContent {
    position: relative;
    padding-left: 5px;
}

.itemContent a:hover {
    text-decoration: underline;
}

.itemContent:hover, .caret:hover {
    background-color: aliceblue;
    background-color: rgba(255,255,255,70%);
}

.items {
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.branch {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.2s ease-in;
}

.branch-expanded {
    grid-template-rows: 1fr;
}

.branch.branch-expanded > .items {
    opacity: 1;
}

.item-active {
    position: relative;
    background: #888;
    background: rgba(128,128,128,50%);
}

.tree .item-active::after {
    content: " ";
    position: absolute;
    border: 1px solid darkred;
    background: crimson;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    top: calc((var(--spacing) / 2) - 5px);
    right: 5px;
}

.tree .item {
    padding-left : calc(2 * var(--spacing) - var(--radius) - 2px);
}

.tree .items {
    margin-left  : calc(var(--radius) - var(--spacing));
    padding-left : 0;
}

.tree .items .item{
    border-left : 2px solid #ddd;
}

.tree .items .item:last-child {
    border-color : transparent;
}

.tree .items .item::before,
.tree .caret::after {
    content: '';
    display: block;
    position: absolute;
    top: calc(var(--spacing) / -2 );
    left: -2px;
    width: calc(var(--spacing) + 2px);
    height: calc(var(--spacing) + 1px);
    border: solid #ddd;
    border-width: 0 0 2px 2px;
}

.tree .item::after,
.tree .caret::before {
    content: '';
    display: block;
    position: absolute;
    top: calc(var(--spacing) / 2 - var(--radius));
    left: calc(var(--spacing) - var(--radius) - 1px);
    width: calc(2 * var(--radius));
    height: calc(2 * var(--radius));
    border-radius: 50%;
    background: #04aee1;
}

.tree .caret::before {
    z-index    : 1;
    background : #04aee1 url('../imgs/expand-collapse.svg') 0;
    transition: background-position 0.2s ease-in;
}

.tree .caret.relative::after {
    border-color: transparent;
}

.tree .caret.relative::before {
    top: calc(var(--spacing) / 2 - var(--radius));
    left: calc((var(--spacing) - var(--radius) - 1px) - (2 * var(--spacing) - var(--radius) - 2px));
}

.tree .caret-expanded::before {
    background-position: calc(-2 * var(--radius)) 0;
}