/* Milestone 11 admin hierarchy: Service → Client → Year → Month */
@media (min-width: 1101px) {
    .app-layout { grid-template-columns: 286px minmax(0, 1fr); }
}

.sidebar-tree-nav {
    gap: 3px;
}

.sidebar-tree-nav > a {
    margin: 0;
}

.sidebar-tree-root,
.sidebar-tree-node {
    min-width: 0;
}

.sidebar-tree-root > summary,
.sidebar-tree-node > summary {
    min-height: 31px;
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr) 25px;
    align-items: center;
    gap: 3px;
    border-radius: 5px;
    color: #dce8eb;
    list-style: none;
    cursor: pointer;
}

.sidebar-tree-root > summary {
    min-height: 35px;
    padding: 0 5px 0 4px;
}

.sidebar-tree-node > summary {
    padding: 0 4px 0 1px;
}

.sidebar-tree-root > summary::-webkit-details-marker,
.sidebar-tree-node > summary::-webkit-details-marker {
    display: none;
}

.sidebar-tree-root > summary:hover,
.sidebar-tree-node > summary:hover {
    background: rgba(255, 255, 255, .065);
}

.sidebar-tree-chevron {
    width: 15px;
    height: 20px;
    display: grid;
    place-items: center;
    color: #8eaab2;
    font-size: 15px;
    line-height: 1;
    transition: transform .12s ease;
}

.sidebar-tree-root[open] > summary > .sidebar-tree-chevron,
.sidebar-tree-node[open] > summary > .sidebar-tree-chevron {
    transform: rotate(90deg);
}

.sidebar-tree-root-link,
.sidebar-tree-label,
.sidebar-tree-month,
.sidebar-tree-empty-link {
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.sidebar-tree-root-link {
    padding: 6px 2px;
    color: #eef5f6;
    font-size: 12px;
    font-weight: 720;
}

.sidebar-tree-root-link.is-current {
    color: #fff;
}

.sidebar-tree-label {
    overflow: hidden;
    padding: 5px 2px;
    color: #d6e3e7;
    font-size: 10.5px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-tree-service > summary .sidebar-tree-label {
    color: #f0f5f6;
    font-size: 11px;
}

.sidebar-tree-label.is-selected {
    color: #57d0be;
}

.sidebar-tree-add {
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    color: #a8c2c9;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
}

.sidebar-tree-add:hover {
    background: rgba(43, 156, 141, .22);
    color: #fff;
}

.sidebar-tree-children {
    position: relative;
    min-width: 0;
    margin-left: 7px;
    padding-left: 9px;
    border-left: 1px solid rgba(255, 255, 255, .075);
}

.sidebar-tree-services {
    max-height: min(52vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}

.sidebar-tree-clients { margin-left: 5px; }
.sidebar-tree-years { margin-left: 4px; }
.sidebar-tree-months { margin: 1px 0 3px 4px; padding-left: 8px; }

.sidebar-tree-month {
    min-height: 28px;
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    margin: 1px 0;
    padding: 4px 5px;
    border-radius: 4px;
    color: #afc2c7;
    font-size: 9.5px;
}

.sidebar-tree-month:hover {
    background: rgba(255, 255, 255, .065);
    color: #fff;
}

.sidebar-tree-month.is-current {
    background: rgba(19, 64, 151, .72);
    box-shadow: inset 2px 0 0 #58b8ff;
    color: #fff;
}

.sidebar-tree-month small {
    color: #78949c;
    font-size: 7px;
    text-transform: uppercase;
}

.sidebar-tree-month.is-current small { color: #bcd7e5; }
.sidebar-month-icon { color: #90a8ae; font-size: 9px; }
.sidebar-tree-month.is-current .sidebar-month-icon { color: #d8efff; }

.sidebar-tree-empty,
.sidebar-tree-empty-link {
    display: block;
    padding: 5px 4px;
    color: #78949c;
    font-size: 9px;
}

.sidebar-tree-empty-link:hover { color: #dcecef; }

/* Keep the hierarchy useful on shorter screens without hiding account controls. */
.app-sidebar {
    overflow-y: auto;
    scrollbar-width: thin;
}

@media (max-width: 1100px) {
    .sidebar-tree-root,
    .sidebar-tree-node,
    .sidebar-tree-services {
        max-height: none;
    }
}
