.menu {
    .menu {
        .item {
            &:last-child {
                padding-bottom: 7px;
            }
        }

        .link {
            grid-template-columns: 16px minmax(0, 1fr);
            grid-gap: 0 8px;
            height: var(--control-height-m);
            padding-left: calc(var(--space-2xl));
            font-size: var(--size-text-s);

            &::after {
                left: 18px;
                width: calc(100% - 36px);
            }

            &__Active {
                color: var(--color-base-essential);

                &::after {
                    background-color: var(--color-control-bg-active);
                }
            }
        }
    }

    &__Dark {
        .menu {
            .link {
                &__Active {
                    color: var(--color-typo-primary);
                }
            }
        }
    }

    &__Tooltip {
        padding: 4px 0;

        .link {
            $this: &;
            grid-template-columns: 16px minmax(0, 1fr);
            grid-gap: 0 8px;
            min-width: 140px;
            height: 42px;
            padding: 0 var(--space-m);
            font-size: var(--size-text-s);
            font-weight: normal;
            color: var(--color-typo-primary);

            &:hover:not(.link__Active) {
                color: var(--color-typo-secondary);
            }
        }
    }
}

.item {
    position: relative;

    &::after {
        content: '';
        position: absolute;
        top: 4px;
        left: 8px;
        width: calc(100% - 16px);
        height: calc(100% - 4px);
        z-index: -1;
        background: var(--color-bg-secondary);
        border-radius: var(--control-radius);
        opacity: 0;
        transition: opacity 0.2s;
    }

    &__Active {
        &::after {
            opacity: 1;
        }
    }
}

.link {
    $this: &;

    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    grid-gap: 0 10px;
    align-items: center;
    height: 52px;
    padding: 0 var(--space-xl) 4px var(--space-2xl);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s, background-color 0.2s;

    &::after {
        content: '';
        position: absolute;
        top: 3px;
        left: 16px;
        z-index: 0;
        width: calc(100% - 32px);
        height: calc(100% - 10px);
        display: block;
        border-radius: var(--control-radius);
        background-color: var(--color-bg-secondary);
        opacity: 0;
        transition: opacity 0.2s, transform 0.2s;
    }

    &__Active {
        &::after {
            opacity: 1;
            transform: none;
        }
    }

    &__Collapsible {
        &#{$this}__Collapsed {
            grid-template-columns: 20px;
            justify-content: center;

            .link_Title,
            .link_TitleWrapper {
                display: none;
            }

            .link_Arrow {
                display: none;
            }
        }
    }

    &__Toggle {
        &::after {
            content: none;
        }
    }

    &__ToggleOpen {
        .link_Arrow {
            transform: rotate(180deg);
        }
    }

    &:hover:not(.link__Active) {
        color: var(--color-typo-primary);
    }
}

.link_BadgeIconWrapper {
    --badge-count-z-index: 1;
    --badge-dot-z-index: 1;
}

.link_Icon {
    position: relative;
    z-index: 1;
    width: 20px;
    height: auto;
}

.link_TitleWrapper {
    --badge-count-z-index: 1;
    --badge-dot-z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.link_Title {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    overflow-x: hidden;
    text-overflow: ellipsis;
}

.link_DotBadge {
    padding-right: 4px;
}

.link_Arrow {
    position: absolute;
    top: 15px;
    right: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    transform-origin: 50% 50%;
    transition: transform 0.16s;

    svg {
        width: 100%;
        height: auto;
    }
}
