/* Redesign: боковое меню (r__*) */

:root {
    --r__sidebar-width: 260px;
    --r__sidebar-width-collapsed: 64px;
    --r__sidebar-bg: #ffffff;
    --r__sidebar-border: #e8eaed;
    --r__sidebar-text: #1f2328;
    --r__sidebar-text-muted: #8b929a;
    --r__sidebar-hover: #f3f4f6;
    --r__sidebar-active: #eef0f2;
    --r__sidebar-icon: #5c6370;
}

.r__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--r__sidebar-width);
    height: 100vh;
    background: var(--r__sidebar-bg);
    border-right: 1px solid var(--r__sidebar-border);
}

.r__sidebar--collapsed {
    width: var(--r__sidebar-width-collapsed);
}

.r__sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    height: 56px;
    padding: 0 14px 0 18px;
    gap: 8px;
}

.r__sidebar--collapsed .r__sidebar__header {
    justify-content: center;
    padding: 0;
}

.r__sidebar__brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--r__sidebar-text);
    text-decoration: none;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
}

.r__sidebar__brand:hover,
.r__sidebar__brand:focus {
    color: var(--r__sidebar-text);
    text-decoration: none;
}

.r__sidebar--collapsed .r__sidebar__brand {
    display: none;
}

.r__sidebar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--r__sidebar-icon);
    cursor: pointer;
    flex-shrink: 0;
}

.r__sidebar__toggle:hover {
    background: var(--r__sidebar-hover);
    color: var(--r__sidebar-text);
}

.r__sidebar__toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

.r__sidebar__scroll {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 10px 16px;
    scrollbar-width: thin;
}

.r__sidebar--collapsed .r__sidebar__scroll {
    padding: 8px 10px;
}

.r__sidebar__primary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.r__nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--r__sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.r__nav-link:hover,
.r__nav-link:focus {
    background: var(--r__sidebar-hover);
    color: var(--r__sidebar-text);
    text-decoration: none;
}

.r__nav-link--active {
    background: var(--r__sidebar-active);
    font-weight: 600;
}

.r__nav-link__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--r__sidebar-icon);
    font-size: 1.125rem;
    line-height: 1;
}

.r__nav-link__icon i {
    font-size: inherit;
    line-height: 1;
}

.r__nav-group--admin > .r__nav-link > .r__nav-link__icon {
    color: #ff0000;
}

.r__nav-link__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r__nav-link__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--r__sidebar-text-muted);
    transition: transform 0.15s ease;
}

.r__nav-link__chevron i {
    font-size: 0.75rem;
}

.r__nav-group--open > .r__nav-link .r__nav-link__chevron {
    transform: rotate(180deg);
}

.r__sidebar--collapsed .r__nav-link {
    justify-content: center;
    padding: 10px;
    min-height: 40px;
}

.r__sidebar--collapsed .r__nav-link__label,
.r__sidebar--collapsed .r__nav-link__chevron,
.r__sidebar--collapsed .r__sidebar__section-title {
    display: none;
}

.r__sidebar--collapsed .r__sidebar__primary {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--r__sidebar-border);
}

.r__sidebar--collapsed .r__sidebar__section {
    margin-top: 0;
}

.r__sidebar--collapsed .r__sidebar__section + .r__sidebar__section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--r__sidebar-border);
}

.r__sidebar__section {
    margin-top: 8px;
}

.r__sidebar__section + .r__sidebar__section {
    margin-top: 14px;
}

.r__sidebar__section-title {
    margin: 0 0 6px;
    padding: 0 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--r__sidebar-text-muted);
}

.r__sidebar__section-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.r__nav-group {
    list-style: none;
}

.r__nav-sub {
    list-style: none;
    margin: 0;
    padding: 2px 0 4px 0;
    display: none;
}

.r__nav-group--open > .r__nav-sub {
    display: block;
}

.r__nav-sub .r__nav-link {
    min-height: 32px;
    padding: 5px 10px 5px 40px;
    font-weight: 400;
    color: #3d4450;
}

.r__nav-sub .r__nav-sub .r__nav-link {
    padding-left: 52px;
    font-size: 0.8125rem;
}

.r__nav-sub .r__nav-link--active {
    background: var(--r__sidebar-active);
    font-weight: 600;
}

.r__nav-divider {
    height: 1px;
    margin: 6px 10px;
    background: var(--r__sidebar-border);
    list-style: none;
}

.r__sidebar--collapsed .r__nav-sub,
.r__sidebar--collapsed .r__nav-divider {
    display: none !important;
}

.r__menu-restricted {
    display: inline-flex;
    margin-right: 4px;
    color: #ef4444;
    font-size: 0.8rem;
    vertical-align: middle;
    opacity: 1;
}


.r__nav-link img {
    height: 14px;
    width: auto;
    margin-right: 4px;
    vertical-align: middle;
}

.r__amp-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    background: #e8f0fe;
    color: #1a73e8;
    font-size: 0.65rem;
    font-weight: 700;
    vertical-align: middle;
}

.r__sidebar__footer {
    position: relative;
    flex-shrink: 0;
    padding: 10px 12px 14px;
    border-top: 1px solid var(--r__sidebar-border);
}

.r__sidebar--collapsed .r__sidebar__footer {
    padding: 12px 0;
    display: flex;
    justify-content: center;
}

.r__sidebar__profile {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    color: inherit;
}

.r__sidebar__profile:hover {
    background: var(--r__sidebar-hover);
}

.r__sidebar--collapsed .r__sidebar__profile {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

.r__sidebar__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #e5e7eb;
}

.r__sidebar__profile-meta {
    min-width: 0;
    flex: 1 1 auto;
}

.r__sidebar--collapsed .r__sidebar__profile-meta {
    display: none;
}

.r__sidebar__profile-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--r__sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.r__sidebar__profile-email {
    display: block;
    font-size: 0.6875rem;
    color: var(--r__sidebar-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.r__sidebar__profile-menu {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(100% + 6px);
    z-index: 20;
    display: none;
    padding: 6px;
    margin: 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--r__sidebar-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 60vh;
    overflow-y: auto;
}

.r__sidebar__profile-menu.is-open {
    display: block;
}

.r__sidebar--collapsed .r__sidebar__profile-menu {
    left: calc(100% + 8px);
    right: auto;
    bottom: 8px;
    width: 240px;
}

.r__sidebar__profile-menu a,
.r__sidebar__profile-menu .r__profile-menu-label {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--r__sidebar-text);
    text-decoration: none;
    font-size: 0.8125rem;
}

.r__sidebar__profile-menu a:hover {
    background: var(--r__sidebar-hover);
    color: var(--r__sidebar-text);
}

.r__profile-menu-name {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--r__sidebar-text-muted);
}

.r__tg-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.r__tg-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
}

.r__tg-status--on {
    background: #22c55e;
}

.r__tg-status--off {
    background: #f59e0b;
}

.r__ceo-report-sum {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.r__sidebar-backdrop {
    display: none;
}

.r__sidebar-open {
    display: none;
}

@media (max-width: 991.98px) {
    .r__sidebar-open {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1030;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid var(--r__sidebar-border);
        border-radius: 12px;
        background: #fff;
        color: var(--r__sidebar-text);
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
        cursor: pointer;
    }

    .r__sidebar-open:hover,
    .r__sidebar-open:focus {
        background: #fff;
        color: var(--r__sidebar-text);
    }

    .r__sidebar-open svg {
        width: 22px;
        height: 22px;
        display: block;
    }

    body.r__sidebar-mobile-open .r__sidebar-open {
        display: none;
    }

    .r__sidebar {
        width: min(var(--r__sidebar-width), calc(100vw - 48px));
        transform: translateX(-105%);
        transition: transform var(--r__transition);
        box-shadow: none;
        pointer-events: none;
    }

    .r__sidebar.r__sidebar--mobile-open {
        transform: translateX(0);
        pointer-events: auto;
        box-shadow: 8px 0 24px rgba(15, 23, 42, 0.15);
    }

    .r__sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(15, 23, 42, 0.35);
    }

    .r__sidebar-backdrop.is-open {
        display: block;
    }
}

@media (min-width: 992px) {
    .r__sidebar-open,
    .r__sidebar-backdrop {
        display: none !important;
    }
}
