/** App shell — extracted from layout_header, sidebar_left, layout_footer */

[x-cloak] { display: none !important; }

/* Auth shell */
/* Auth pages: make all major layout wrappers the same gray. */
html,
body {
    background: #f3f4f6 !important;
}
/* The app shell + its main content wrapper must not stay white. */
body.eidoc-auth-page .eidoc-app-shell,
body.eidoc-auth-page #page-component,
body.eidoc-auth-page .eidoc-app-shell > div.flex.flex-col.w-full,
body.eidoc-auth-page .eidoc-app-shell > div.flex.flex-col.w-full > div {
    background: #f3f4f6 !important;
}

/* Layout header mobile + desktop */
.eidoc-public-guest div[class*="fixed"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-primary/"],
.eidoc-public-guest div[class*="fixed"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-secondary/"],
.eidoc-public-guest div[class*="fixed"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-accent/"],
.eidoc-public-guest div[class*="absolute"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-primary/"],
.eidoc-public-guest div[class*="absolute"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-secondary/"],
.eidoc-public-guest div[class*="absolute"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-accent/"] {
    display: none !important;
}
/* Мобильные: скролл всей страницы (body), не вложенного main */
@media (max-width: 1023px) {
    /* Pull-to-refresh: тень pill не должна просвечивать над шапкой в покое */
    #eidoc-pull-indicator {
        overflow: hidden;
    }
    #eidoc-pull-indicator > div {
        box-shadow: none !important;
    }
    html, body { overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .eidoc-mobile-logo-link:active,
    .eidoc-mobile-logo-link:focus,
    .eidoc-mobile-logo-link:focus-visible {
        box-shadow: none !important;
        background: transparent !important;
    }
    .eidoc-mobile-logo-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }
    .eidoc-mobile-logo-link .eidoc-site-logo,
    .eidoc-mobile-logo-link .eidoc-site-logo-wrap img {
        height: 2.25rem !important;
        max-height: 2.25rem;
        width: auto;
        max-width: min(70vw, 12rem);
        object-fit: contain;
    }
    /* Мобильная шапка: логотип строго по центру панели */
    .eidoc-topbar .eidoc-topbar__inner.navbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        align-items: center;
        column-gap: 0.25rem;
    }
    .eidoc-topbar .eidoc-topbar__start {
        justify-self: start;
        min-width: 0;
    }
    .eidoc-topbar .navbar-center {
        justify-self: center;
        grid-column: 2;
        min-width: 0;
    }
    .eidoc-topbar .navbar-end {
        justify-self: end;
        grid-column: 3;
        min-width: 0;
    }
    /* Мобильный live search: на всю ширину шапки, не только центральную колонку grid */
    .eidoc-mobile-search-bar {
        width: 100%;
        box-sizing: border-box;
    }
    .eidoc-mobile-search-bar .eidoc-mobile-search-input {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    /* На мобильных отключаем декоративные цветные "пятна" фона */
    div[class*="fixed"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-primary/"],
    div[class*="fixed"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-secondary/"],
    div[class*="fixed"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-accent/"],
    div[class*="absolute"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-primary/"],
    div[class*="absolute"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-secondary/"],
    div[class*="absolute"][class*="rounded-full"][class*="blur"][class*="-z-10"][class*="pointer-events-none"][class*="bg-accent/"] {
        display: none !important;
    }
    #page-component {
        touch-action: pan-y;
    }
    /*
     * Выездной сайдбар: симметричный зазор --eidoc-mobile-drawer-gap от шапки и от нижнего таббара.
     * Резерв снизу: bar 3.25rem + padding outer 5px (--eidoc-mobile-bottom-chrome); без env(safe-area) у outer — иначе бар прыгает при скролле на iOS.
     * Закрыто: translate на (100% + gap), иначе при left:gap виден «кусок» панели.
     */
    body.eidoc-public,
    .eidoc-app-shell {
        --eidoc-mobile-drawer-gap: 0.75rem;
        /* h-12 (4rem) + border шапки; совпадает с .eidoc-sticky-header на мобилке */
        --eidoc-mobile-header-chrome: calc(4.125rem + env(safe-area-inset-top, 0px));
        /* Зона старта pull-to-refresh ниже шапки (mobile-pull-refresh.js) */
        --eidoc-mobile-pull-zone-extra: 160px;
        --eidoc-mobile-drawer-top: calc(var(--eidoc-mobile-header-chrome) + var(--eidoc-mobile-drawer-gap));
        /* До верха pill нижнего меню: bar 3.25rem + padding-bottom outer 5px (без env — иначе панель прыгает при скролле на iOS) */
        --eidoc-mobile-bottom-chrome: calc(3.25rem + 5px);
    }
    /* Явный top: Tailwind arbitrary var() на aside иногда не срабатывает */
    body.eidoc-public .eidoc-app-shell .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer.eidoc-sidebar-aside--foundation {
        top: var(--eidoc-mobile-drawer-top) !important;
        z-index: 44 !important;
        max-height: calc(
            100dvh - var(--eidoc-mobile-drawer-top) - var(--eidoc-mobile-bottom-chrome) - var(--eidoc-mobile-drawer-gap)
        ) !important;
        /* Высота ограничена — весь список (включая «Выход») скроллится внутри панели, а не обрезается */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .eidoc-app-shell:not(:has(#left-sidebar-toggle:checked)) .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer {
        transform: translateX(calc(-100% - var(--eidoc-mobile-drawer-gap)));
        pointer-events: none;
    }
    .eidoc-app-shell:has(#left-sidebar-toggle:checked) .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer {
        transform: translateX(0);
        pointer-events: auto;
    }
    /* Мобильный drawer: один скролл на aside, без обрезки «Личное» вложенными max-h / overflow */
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer #left-sidebar {
        min-height: 0;
    }
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer #left-sidebar > .relative.z-0.flex.min-h-0 {
        flex: 0 0 auto !important;
        min-height: 0 !important;
    }
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer nav.flex-1 {
        flex: 0 0 auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer .sidebar-scroll-public {
        max-height: none !important;
        overflow-y: visible !important;
    }
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer .sidebar-scroll-private {
        flex: none !important;
        min-height: 0 !important;
        overflow-y: visible !important;
    }
    /* x-transition.opacity на подписях пунктов может оставлять opacity:0 до конца анимации — на мобилке всегда показываем текст */
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer #left-sidebar .menu a .font-medium,
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer #left-sidebar .menu a .tracking-wide {
        opacity: 1 !important;
    }
    .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-personal-nav {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    }
    .eidoc-sidebar-aside.eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar {
        display: flex;
        flex-direction: column;
        min-height: 100%;
        flex: 1 1 auto;
    }
    .eidoc-sidebar-aside.eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .eidoc-sidebar-expert-chip {
        margin-top: auto;
        flex-shrink: 0;
    }
    /* Foundation mobile drawer — тот же navy, что и desktop sidebar */
    body.eidoc-public .eidoc-sidebar-aside.eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer {
        background-color: var(--ui-sidebar-bg, #0b1f3a) !important;
        border-color: var(--ui-sidebar-border, rgba(255, 255, 255, 0.06)) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar {
        background-color: transparent !important;
        --sidebar-drawer-fg: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
        --sidebar-drawer-muted: var(--ui-sidebar-muted, rgba(255, 255, 255, 0.44));
        --sidebar-drawer-active-bg: var(--ui-sidebar-active-bg, #1d4ed8);
        --sidebar-drawer-active-fg: #ffffff;
        --sidebar-drawer-hover-bg: var(--ui-sidebar-hover-bg, #1e293b);
        --sidebar-drawer-hover-ring: transparent;
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-inactive,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-inactive .eidoc-sidebar-nav-label,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-inactive .font-medium,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-inactive .tracking-wide,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-inactive .sidebar-icon-wrap {
        color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82)) !important;
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-active,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-active .eidoc-sidebar-nav-label,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-active .font-medium,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-active .tracking-wide,
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-active .sidebar-icon-wrap {
        color: #fff !important;
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-active {
        background-color: var(--ui-sidebar-active-bg, #1d4ed8) !important;
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .sidebar-link.sidebar-link-inactive:hover {
        background-color: var(--ui-sidebar-hover-bg, #1e293b) !important;
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar .eidoc-sidebar-nav-separator {
        border-top-color: var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation.eidoc-sidebar-mobile-drawer #left-sidebar [x-show="!$store.userState.isLoggedIn"] p {
        color: var(--ui-sidebar-muted, rgba(255, 255, 255, 0.44)) !important;
    }
    /* Гость: нет кнопки drawer — показываем панель с входом/регистрацией без выезда по гамбургеру */
    .eidoc-public-guest .eidoc-sidebar-aside.eidoc-sidebar-mobile-drawer {
        transform: translateX(0) !important;
        pointer-events: auto !important;
    }
}
/* Десктоп: плавный скролл и один вертикальный скролл в main — сайдбар не уезжает при прокрутке */
@media (min-width: 1024px) {
    #page-component {
        -webkit-overflow-scrolling: touch;
    }
    /* Документация: свой скролл/цепочка flex — без этой блокировки иначе ломается прокрутка */
    /* Та же схема, что на остальных страницах: один вертикальный скролл в main (#page-component), не на window */
    html:has(body.eidoc-public) {
        height: 100%;
        overflow: hidden;
    }
    body.eidoc-public {
        height: 100%;
        min-height: 0 !important;
        overflow: hidden;
    }
    html:has(body.eidoc-public) .eidoc-app-shell {
        height: 100dvh;
        max-height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }
}

/* Left sidebar — ds.tsx tokens on Foundation navy shell (all breakpoints) */
body.eidoc-public:not(.eidoc-landing-page) .eidoc-sidebar-aside--foundation #left-sidebar,
body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar {
    --sidebar-drawer-fg: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
    --sidebar-drawer-muted: var(--ui-sidebar-muted, rgba(255, 255, 255, 0.44));
    --sidebar-drawer-active-bg: var(--ui-sidebar-active-bg, #1d4ed8);
    --sidebar-drawer-active-fg: #ffffff;
    --sidebar-drawer-hover-bg: var(--ui-sidebar-hover-bg, #1e293b);
    --sidebar-drawer-hover-ring: transparent;
    --sidebar-toggle-border: rgba(255, 255, 255, 0.2);
    --sidebar-toggle-icon: #fff;
}

@media (min-width: 1024px) {
    body:not(.eidoc-public) #left-sidebar {
        --sidebar-drawer-fg: #1e3a5f;
        --sidebar-drawer-muted: rgba(30, 58, 95, 0.72);
        --sidebar-drawer-active-bg: rgba(37, 99, 235, 0.2);
        --sidebar-drawer-hover-bg: rgba(37, 99, 235, 0.14);
        --sidebar-drawer-hover-ring: rgba(37, 99, 235, 0.22);
        --sidebar-toggle-border: rgba(30, 58, 95, 0.35);
        --sidebar-toggle-icon: #2563eb;
    }

    body.eidoc-public #left-sidebar {
        --sidebar-toggle-border: rgba(255, 255, 255, 0.2);
        --sidebar-toggle-icon: #fff;
    }
    body.eidoc-public.dark #left-sidebar,
    html[data-theme="dark"] body.eidoc-public #left-sidebar {
        --sidebar-drawer-fg: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
        --sidebar-drawer-muted: var(--ui-sidebar-muted, rgba(255, 255, 255, 0.44));
        --sidebar-drawer-active-bg: var(--ui-sidebar-active-bg, #1d4ed8);
        --sidebar-drawer-hover-bg: var(--ui-sidebar-hover-bg, #1e293b);
        --sidebar-drawer-hover-ring: transparent;
        --sidebar-toggle-border: rgba(255, 255, 255, 0.25);
        --sidebar-toggle-icon: #fff;
    }
}

#left-sidebar .sidebar-link {
    background-color: transparent;
    color: var(--sidebar-drawer-fg, hsl(var(--bc)));
    border-radius: 15px;
}

body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link {
    border-radius: var(--ui-radius-sm, 0.5rem);
}

body.eidoc-public #left-sidebar .sidebar-link {
    color: var(--sidebar-drawer-fg, rgba(255, 255, 255, 0.82));
}

#left-sidebar .sidebar-link .sidebar-icon-wrap {
    background-color: transparent !important;
    color: inherit;
}

#left-sidebar .sidebar-link:hover,
#left-sidebar .sidebar-link:focus,
#left-sidebar .sidebar-link:focus-visible {
    border-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

@media (min-width: 1024px) {
    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-link.sidebar-link-inactive:hover,
    body:not(.eidoc-public) #left-sidebar .sidebar-link.sidebar-link-inactive:hover {
        background-color: var(--sidebar-drawer-hover-bg) !important;
        box-shadow: inset 0 0 0 1px var(--sidebar-drawer-hover-ring);
    }
    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar details summary.sidebar-link:hover,
    body:not(.eidoc-public) #left-sidebar details summary.sidebar-link:hover {
        background-color: var(--sidebar-drawer-hover-bg) !important;
        box-shadow: inset 0 0 0 1px var(--sidebar-drawer-hover-ring);
    }
    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-link.sidebar-link-active,
    body:not(.eidoc-public) #left-sidebar .sidebar-link.sidebar-link-active {
        background-color: var(--sidebar-drawer-active-bg) !important;
        color: #fff !important;
        font-weight: 600;
        border-radius: 15px !important;
    }
    #left-sidebar .sidebar-link.sidebar-link-active .sidebar-icon-wrap,
    #left-sidebar .sidebar-link.sidebar-link-active .font-medium,
    #left-sidebar .sidebar-link.sidebar-link-active .tracking-wide {
        color: #fff !important;
    }
    #left-sidebar .sidebar-link.sidebar-link-inactive {
        color: var(--sidebar-drawer-fg, var(--ui-sidebar-text, rgba(255, 255, 255, 0.82))) !important;
        font-weight: 400;
    }
    #left-sidebar .sidebar-link.sidebar-link-inactive .sidebar-icon-wrap,
    #left-sidebar .sidebar-link.sidebar-link-inactive .font-medium,
    #left-sidebar .sidebar-link.sidebar-link-inactive .tracking-wide {
        color: inherit !important;
    }
}

@media (max-width: 1023px) {
    body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive:hover {
        background-color: var(--ui-sidebar-hover-bg, #1e293b) !important;
        box-shadow: none !important;
    }
    body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active {
        background-color: var(--ui-sidebar-active-bg, #1d4ed8) !important;
        color: #fff !important;
        font-weight: 600;
    }
    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-link.sidebar-link-inactive:hover,
    body:not(.eidoc-public) #left-sidebar .sidebar-link.sidebar-link-inactive:hover {
        background-color: hsla(var(--bc) / 0.06);
    }
    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-link.sidebar-link-active,
    body:not(.eidoc-public) #left-sidebar .sidebar-link.sidebar-link-active {
        background-color: hsla(var(--bc) / 0.08);
        font-weight: 600;
    }
}

#left-sidebar.sidebar-collapsed .sidebar-link,
#left-sidebar.sidebar-collapsed .sidebar-link:hover {
    box-shadow: none !important;
}

@media (min-width: 1024px) {
    #left-sidebar.sidebar-collapsed .sidebar-link.sidebar-link-active {
        background-color: var(--sidebar-drawer-active-bg) !important;
    }
}

/* Кнопка коллапса — вне скролла меню, по центру #left-sidebar, с выносом вправо. */
@media (min-width: 1024px) {
    #left-sidebar {
        position: relative;
        overflow: visible !important;
    }
}

#left-sidebar .sidebar-toggle-rail {
    position: static;
    width: 0;
    height: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    overflow: visible;
    pointer-events: none;
}

@media (min-width: 1024px) {
    #left-sidebar .sidebar-toggle-rail {
        position: absolute;
        top: 50%;
        right: 0;
        z-index: 60;
        transform: translateY(-50%);
    }
}

@media (max-width: 1023px) {
    #left-sidebar .sidebar-toggle-rail {
        display: none !important;
    }
}

#left-sidebar .sidebar-toggle-rail .sidebar-menu-toggle {
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 60;
    pointer-events: auto;
    /* Половина кнопки за границей сайдбара — не обрезать overflow у aside. */
    transform: translate(calc(50% + 9px), -50%);
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--sidebar-toggle-icon, #2563eb);
    border-radius: 50%;
    background-color: #ffffff;
    border: 1px solid var(--sidebar-toggle-border, rgba(30, 58, 95, 0.35));
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    -webkit-tap-highlight-color: transparent;
}

#left-sidebar .sidebar-toggle-rail .sidebar-menu-toggle i {
    display: block;
    font-size: 11px;
    line-height: 1;
    width: 1em;
    height: 1em;
    text-align: center;
}

#left-sidebar .sidebar-toggle-rail .sidebar-menu-toggle:hover {
    background-color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.dark #left-sidebar .sidebar-toggle-rail .sidebar-menu-toggle {
    background-color: hsl(var(--b1));
    border-color: hsl(var(--bc) / 0.35);
    color: hsl(var(--p));
}

#left-sidebar .sidebar-toggle-rail .sidebar-menu-toggle:focus-visible {
    outline: 2px solid hsl(var(--p));
    outline-offset: 2px;
}

aside.sidebar-aside-animate {
    transition-property: width, min-width, max-width;
    transition-duration: 0.5s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
}

@media (prefers-reduced-motion: reduce) {
    aside.sidebar-aside-animate {
        transition-duration: 0.01ms;
        will-change: auto;
    }
}

#left-sidebar.sidebar-expanded .menu {
    text-align: left;
}

#left-sidebar.sidebar-expanded .sidebar-personal-nav .menu li > *:not(ul) {
    justify-content: flex-start;
    width: 100%;
    text-align: left;
}

@media (min-width: 1024px) {
    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar,
    body:not(.eidoc-public) #left-sidebar {
        height: auto !important;
        min-height: auto !important;
        flex: 0 0 auto !important;
        align-self: flex-start;
    }

    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-content-stack,
    body:not(.eidoc-public) #left-sidebar .sidebar-content-stack {
        flex: 0 0 auto;
        min-height: auto;
    }

    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-main-nav,
    body:not(.eidoc-public) #left-sidebar .sidebar-main-nav {
        flex: 0 0 auto;
        min-height: auto;
    }

    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-scroll-public,
    body:not(.eidoc-public) #left-sidebar .sidebar-scroll-public {
        max-height: none;
        overflow-y: visible;
        padding-bottom: 0.5rem;
    }

    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-scroll-private,
    body:not(.eidoc-public) #left-sidebar .sidebar-scroll-private {
        flex: 0 0 auto;
        min-height: auto;
        overflow-y: visible;
    }

    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-personal-nav,
    body:not(.eidoc-public) #left-sidebar .sidebar-personal-nav {
        padding-bottom: 0.5rem;
    }

    /* Скролл только у меню; aside и кнопка шеврона — overflow: visible */
    .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) {
        overflow: visible !important;
    }

    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-content-stack,
    body:not(.eidoc-public) #left-sidebar .sidebar-content-stack {
        max-height: calc(100dvh - 5.5rem);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

/* Планшет: компактные пункты, чтобы меню помещалось в drawer / колонку */
@media (min-width: 768px) and (max-width: 1023px),
       (min-width: 1024px) and (max-width: 1366px) {
    #left-sidebar .sidebar-main-nav .menu > li {
        margin-top: 0.125rem !important;
        margin-bottom: 0.125rem !important;
    }

    #left-sidebar .sidebar-link {
        padding-top: 0.2rem !important;
        padding-bottom: 0.2rem !important;
    }

    body.eidoc-public .eidoc-sidebar-aside:not(.eidoc-sidebar-aside--foundation) #left-sidebar .sidebar-icon-wrap,
    body:not(.eidoc-public) #left-sidebar .sidebar-icon-wrap {
        width: 2rem !important;
        height: 2rem !important;
        font-size: 0.85rem !important;
    }

    #left-sidebar .sidebar-main-nav .menu a .font-medium,
    #left-sidebar .sidebar-main-nav .menu a .tracking-wide,
    #left-sidebar details summary .tracking-wide,
    #left-sidebar details summary .font-medium {
        font-size: 0.8125rem !important;
        line-height: 1.2 !important;
    }

    #left-sidebar .sidebar-personal-nav > p {
        margin-top: 0.125rem !important;
        margin-bottom: 0.25rem !important;
        font-size: 0.65rem !important;
    }
}

#left-sidebar .sidebar-content-stack.sidebar-menu-fit-scale {
    transform-origin: top center;
}

/* Legacy sidebar card styles — overridden by Foundation layout below on lg */

/* Public topbar — card surface */
body.eidoc-public .eidoc-app-topbar,
body.eidoc-public header.eidoc-sticky-header,
body.eidoc-public .eidoc-topbar {
    background-color: var(--ui-color-surface) !important;
    border-bottom: 1px solid var(--ui-color-border);
    box-shadow: var(--ui-shadow-sm);
}

/* ── Foundation shell layout (Layout.tsx) — desktop ── */
@media (min-width: 1024px) {
  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) {
    --eidoc-sidebar-w: 14rem;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) .eidoc-sticky-header.eidoc-app-topbar {
    left: var(--eidoc-sidebar-w);
    width: calc(100% - var(--eidoc-sidebar-w));
  }

  /* Статика / блог: без левого сайдбара — topbar на всю ширину, контент ниже fixed-шапки */
  body.eidoc-public.eidoc-layout--no-sidebar .eidoc-sticky-header.eidoc-app-topbar {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
  }

  body.eidoc-public.eidoc-layout--no-sidebar .eidoc-layout-body {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-top: var(--ui-topbar-h, 3rem);
    min-height: 100dvh;
    box-sizing: border-box;
  }

  body.eidoc-public.eidoc-layout--no-sidebar .eidoc-layout-row {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.eidoc-public .eidoc-sticky-header.eidoc-app-topbar.-translate-y-full {
    transform: translateY(0) !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) .eidoc-layout-body {
    margin-left: var(--eidoc-sidebar-w);
    width: calc(100% - var(--eidoc-sidebar-w));
    max-width: calc(100% - var(--eidoc-sidebar-w));
    padding-top: var(--ui-topbar-h, 3rem);
    min-height: 100dvh;
    box-sizing: border-box;
  }

  /* Экзамены: короткая страница — без растягивания; canvas на всей оболочке (см. eidoc-route-exams) */
  body.eidoc-public.eidoc-route-exams .eidoc-app-shell,
  body.eidoc-public .eidoc-app-shell:has(.eidoc-exams-page) {
    background-color: var(--ui-color-canvas, #f1f5f9) !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-exams-page) .eidoc-layout-body,
  body.eidoc-public .eidoc-app-shell:has(.eidoc-exams-page) .eidoc-layout-body--exams-compact,
  body.eidoc-public.eidoc-route-exams .eidoc-layout-body {
    min-height: auto !important;
    height: auto !important;
    flex: 0 0 auto !important;
    background-color: var(--ui-color-canvas, #f1f5f9) !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-exams-page) .eidoc-content-shell {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
    background-color: var(--ui-color-canvas, #f1f5f9) !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-exams-page) .eidoc-layout-row {
    flex: 0 0 auto !important;
    height: auto !important;
    align-items: flex-start !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) .eidoc-layout-row {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-top: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 0 !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) .eidoc-sidebar-aside.eidoc-sidebar-aside--foundation {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) .eidoc-layout-body.eidoc-content-shell {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) .eidoc-layout-row {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) #page-component.eidoc-main-with-sidebar:not(:has(.eidoc-exams-page)) {
    width: 100% !important;
    max-width: none !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
  }

  /* Кабинет: фиксированная высота main → скролл работает над любыми блоками внутри */
  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) #page-component.eidoc-main-with-sidebar.overflow-y-auto:not(:has(.eidoc-exams-page)) {
    min-height: 0 !important;
    max-height: calc(200dvh - var(--ui-topbar-h, 3rem)) !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.eidoc-public .eidoc-app-shell:has(.eidoc-sidebar-aside--foundation) #page-component.eidoc-main-with-sidebar:has(.eidoc-exams-page),
  body.eidoc-public .eidoc-app-shell:has(.eidoc-exams-page) #page-component.eidoc-main-exams-compact {
    width: 100% !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    flex-grow: 0 !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - var(--ui-topbar-h, 3rem)) !important;
    align-self: flex-start !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.eidoc-public .eidoc-sidebar-aside.eidoc-sidebar-aside--foundation {
    width: var(--eidoc-sidebar-w) !important;
    min-width: var(--eidoc-sidebar-w) !important;
    max-width: var(--eidoc-sidebar-w) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background-color: var(--ui-sidebar-bg, #0b1f3a) !important;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar {
    height: 100% !important;
    min-height: 100dvh !important;
    flex: 1 1 auto !important;
    align-self: stretch !important;
    display: flex;
    flex-direction: column;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .eidoc-sidebar-expert-chip {
    margin-top: auto;
    flex-shrink: 0;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-content-stack {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    scrollbar-width: none;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-content-stack::-webkit-scrollbar {
    display: none;
  }

  body.eidoc-public .eidoc-sidebar-brand {
    width: 100%;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  /* Sidebar: eidoc-logo-sidebar.svg — белые буквы + синяя D (без invert) */
  body.eidoc-public .eidoc-sidebar-brand__logo {
    display: block;
    height: 22px;
    width: auto;
    max-width: 8.5rem;
    object-fit: contain;
    filter: none;
  }

  /* ds.tsx SidebarNavItem: inactive sidebarText, active #fff on sidebarActive */
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar {
    --sidebar-drawer-fg: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
    --sidebar-drawer-muted: var(--ui-sidebar-muted, rgba(255, 255, 255, 0.44));
    --sidebar-drawer-active-bg: var(--ui-sidebar-active-bg, #1d4ed8);
    --sidebar-drawer-active-fg: #ffffff;
    --sidebar-drawer-hover-bg: var(--ui-sidebar-hover-bg, #1e293b);
    --sidebar-drawer-hover-ring: transparent;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .menu a,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link {
    border-radius: var(--ui-radius-md, 0.5rem);
    font-size: 0.8125rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .menu a.sidebar-link-inactive,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive .font-medium,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive .tracking-wide,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive .sidebar-icon-wrap {
    color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82)) !important;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive .font-medium,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive .tracking-wide {
    color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82)) !important;
    font-weight: 400 !important;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .menu a.sidebar-link-active,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active .font-medium,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active .tracking-wide,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active .sidebar-icon-wrap,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active .eidoc-sidebar-nav-label {
    color: #fff !important;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active {
    background-color: var(--ui-sidebar-active-bg, #1d4ed8) !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: none !important;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-icon-wrap {
    width: 15px !important;
    min-width: 15px !important;
    height: 15px !important;
    font-size: 0.9375rem !important;
    background-color: transparent !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-icon-wrap i[class*="fa-"],
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link i[class*="fa-"] {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
  }

  /* Легче макета Lucide: неактивные solid-иконки чуть приглушены (far для FA Pro-only глифов не подходит) */
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive .sidebar-icon-wrap {
    opacity: 0.92;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active .sidebar-icon-wrap {
    opacity: 1;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .eidoc-sidebar-nav-separator {
    height: 0;
    margin: 0.5rem 0.5rem;
    border: 0;
    border-top: 1px solid var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
    pointer-events: none;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .eidoc-sidebar-main-nav--foundation {
    padding: 0.75rem;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .eidoc-sidebar-nav-label {
    font-weight: 400;
    letter-spacing: normal;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-active .eidoc-sidebar-nav-label {
    font-weight: 600;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar details summary.sidebar-link:hover,
  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-link.sidebar-link-inactive:hover {
    background-color: var(--ui-sidebar-hover-bg, #1e293b) !important;
    color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82)) !important;
    box-shadow: none !important;
  }

  /* Sidebar: фиксированная ширина 224px, без collapse (макет) */
  body.eidoc-public aside.sidebar-aside-animate {
    transition: none !important;
  }

  body.eidoc-public #left-sidebar.sidebar-collapsed .sidebar-link .font-medium,
  body.eidoc-public #left-sidebar.sidebar-collapsed .sidebar-link .tracking-wide {
    opacity: 1 !important;
  }

  body.eidoc-public #left-sidebar .sidebar-link {
    gap: 0.625rem;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    margin-bottom: 0.125rem;
  }

  body.eidoc-public .eidoc-sidebar-aside--foundation #left-sidebar .sidebar-personal-nav > p {
    color: var(--ui-sidebar-muted, rgba(255, 255, 255, 0.44)) !important;
  }

  body.eidoc-public #left-sidebar .sidebar-personal-nav {
    border-top: 1px solid var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }

  body.eidoc-public #left-sidebar .sidebar-personal-nav > p {
    display: none !important;
  }

  body.eidoc-public #left-sidebar .sidebar-scroll-public {
    border-bottom: none;
  }

  body.eidoc-public #left-sidebar .sidebar-main-nav .menu > li {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Topbar: search слева, иконки справа (Layout.tsx) */
  body.eidoc-public .eidoc-topbar__inner.navbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
  }

  body.eidoc-public .eidoc-topbar .navbar-start,
  body.eidoc-public .eidoc-topbar .eidoc-topbar__start {
    width: auto;
    min-width: 0;
    padding: 0;
    overflow: visible;
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  body.eidoc-public .eidoc-topbar .navbar-center {
    position: static;
    transform: none;
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    justify-content: center;
  }

  body.eidoc-public .eidoc-topbar .navbar-end {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.eidoc-public.eidoc-layout--no-sidebar .eidoc-topbar .navbar-start,
  body.eidoc-public.eidoc-layout--no-sidebar .eidoc-topbar .eidoc-topbar__start {
    flex: 0 1 auto;
    max-width: min(36rem, 55vw);
  }

  body.eidoc-public.eidoc-layout--no-sidebar .eidoc-topbar .navbar-end {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  body.eidoc-public.eidoc-layout--no-sidebar .eidoc-topbar-logo-link {
    display: inline-flex !important;
  }

  body.eidoc-public .eidoc-topbar__inner.navbar {
    height: var(--ui-topbar-h, 3rem);
    min-height: var(--ui-topbar-h, 3rem);
  }

  body.eidoc-public .eidoc-topbar-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0.5rem;
    border: none;
    border-radius: var(--ui-radius-md, 0.5rem);
    background: transparent;
    color: var(--ui-color-muted, #6b7280);
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  body.eidoc-public .eidoc-topbar-icon-btn:hover {
    background-color: var(--ui-color-canvas, #f1f5f9);
    color: var(--ui-color-muted, #6b7280);
  }

  body.eidoc-public .eidoc-topbar-icon-btn i {
    font-size: 17px;
    line-height: 1;
  }

  body.eidoc-public .eidoc-topbar-icon-btn.btn {
    min-height: unset;
    height: 2.25rem;
    width: 2.25rem;
    box-shadow: none;
  }

  body.eidoc-public .eidoc-topbar-profile {
    border: none;
    background: transparent;
    cursor: pointer;
  }

  .eidoc-topbar-profile__avatar {
    width: 2rem;
    height: 2rem;
    border-radius: var(--ui-radius-pill, 9999px);
    overflow: hidden;
    flex-shrink: 0;
  }

  .eidoc-topbar-profile__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Footer в макете нет */
  body.eidoc-public #eidoc-site-footer {
    display: none !important;
  }

  body.eidoc-public #page-component {
    padding-bottom: 0 !important;
  }
}

/* Topbar utilities */
body.eidoc-public .eidoc-topbar-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.625rem;
  border-radius: var(--ui-radius-md);
  border: 1px solid var(--ui-color-border);
  background: var(--ui-color-canvas);
  color: var(--ui-color-muted);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

body.eidoc-public .eidoc-topbar-pill:hover {
  color: var(--ui-color-ink);
  border-color: var(--ui-color-border-strong);
}

body.eidoc-public .eidoc-topbar-icon-btn .absolute {
  pointer-events: none;
}

/* Live search dropdown — anchored under topbar field (desktop) */
@media (min-width: 1024px) {
  body.eidoc-public .eidoc-topbar,
  body.eidoc-public .eidoc-topbar__inner,
  body.eidoc-public .eidoc-topbar .eidoc-topbar__start,
  body.eidoc-public .eidoc-topbar-search-wrap {
    overflow: visible;
  }

  body.eidoc-public .eidoc-live-search-dropdown--desktop .eidoc-live-search-dropdown__panel {
    width: 100%;
  }

  /* Профиль в header (lg+): та же карточка, что у раскрытия в нижнем меню */
  .eidoc-topbar-profile-menu.eidoc-bottom-nav__shell {
    overflow: hidden;
  }

  .eidoc-topbar-profile-menu .eidoc-bottom-nav__profile-panel {
    border-bottom: none;
  }
}

body.eidoc-public .eidoc-footer-link {
  color: var(--ui-color-muted);
  text-decoration: none;
}

body.eidoc-public .eidoc-footer-link:hover {
  color: var(--brand-blue);
}

/* Legacy hook: держим в тон Foundation sidebar (класс в разметке может не использоваться) */
@media (max-width: 1023px) {
  body.eidoc-public .eidoc-mobile-bottom-nav {
    height: 3.5rem;
    background: var(--ui-sidebar-bg, #0b1f3a);
    border-top: 1px solid var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
  }
}

.eidoc-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 48;
}

/* Не полагаться только на Tailwind lg:hidden — display в ui-shell перебивает утилиты (см. topbar icons). */
@media (max-width: 1023px) {
  .eidoc-bottom-nav:not(.eidoc-bottom-nav--route-hidden) {
    display: block !important;
    visibility: visible !important;
    pointer-events: none;
  }

  .eidoc-bottom-nav:not(.eidoc-bottom-nav--route-hidden) .eidoc-bottom-nav__outer {
    pointer-events: auto;
  }

  .eidoc-bottom-nav--route-hidden {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .eidoc-bottom-nav {
    display: none !important;
  }
}

/* Баннер cookie не перекрывает нижнюю навигацию */
@media (max-width: 1023px) {
  .eidoc-cookie-consent {
    bottom: var(--eidoc-mobile-bottom-chrome, calc(3.25rem + 5px));
    z-index: 47;
  }
}

.eidoc-bottom-nav__outer {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* Горизонтально: safe-area + минимум 12px — pill не обрезается на закруглённых краях; снизу только 5px (без env), иначе бар прыгает при скролле на iOS */
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  padding-bottom: 5px;
}

.eidoc-bottom-nav__shell {
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid var(--ui-color-border, #e2e8f0);
  background: var(--ui-color-surface, #fff);
  box-shadow: var(--ui-shadow-lg, 0 8px 24px rgba(15, 23, 42, 0.12));
}

.eidoc-bottom-nav__profile-panel,
.bottom-nav-profile-panel {
  color: var(--ui-color-text, #0f172a);
  background: var(--ui-color-surface, #fff);
  border-bottom: 1px solid var(--ui-color-border-light, #f1f5f9);
  padding: 0.5rem 0.625rem 0.5rem;
}

.eidoc-bottom-nav__profile-name,
.bottom-nav-profile-name {
  padding: 0 0.75rem 0.625rem;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ui-color-ink, #0f172a);
  border-bottom: 1px solid var(--ui-color-border-light, #f1f5f9);
}

.eidoc-bottom-nav__profile-menu {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding-top: 0.5rem;
  max-height: calc(100dvh - 7rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.eidoc-bottom-nav__profile-item,
.bottom-nav-profile-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.5rem;
  border-radius: var(--ui-radius-md, 0.5rem);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ui-color-text, #0f172a);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  border: none;
  background: transparent;
  cursor: pointer;
}

.eidoc-bottom-nav__profile-item:hover,
.eidoc-bottom-nav__profile-item:focus-visible,
.bottom-nav-profile-item:hover,
.bottom-nav-profile-item:focus-visible {
  background: var(--brand-blue-light, #eff6ff);
  color: var(--brand-blue, #1d4ed8);
}

.eidoc-bottom-nav__profile-item i,
.bottom-nav-profile-item i {
  width: 1.25rem;
  flex-shrink: 0;
  text-align: center;
  color: var(--brand-blue, #1d4ed8);
}

.eidoc-bottom-nav__profile-divider {
  margin: 0.375rem 0;
  border-top: 1px solid var(--ui-color-border-light, #f1f5f9);
}

.eidoc-bottom-nav__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.125rem;
  min-width: 0;
  height: 3.25rem;
  padding: 0.375rem 0.375rem;
  background: var(--brand-blue, #1d4ed8);
  color: #fff;
  transition: border-radius 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  border-radius: 1rem;
}

.eidoc-bottom-nav__bar--menu-open {
  border-radius: 0 0 0.875rem 0.875rem;
}

.eidoc-bottom-nav__slot {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  flex: 1 1 0%;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.eidoc-bottom-nav__slot:active {
  transform: scale(0.96);
}

.eidoc-bottom-nav__slot--active {
  flex: 0 0 auto;
}

.eidoc-bottom-nav__slot:not(.eidoc-bottom-nav__slot--active) .eidoc-bottom-nav__visual--active {
  display: none;
}

.eidoc-bottom-nav__slot--active .eidoc-bottom-nav__visual--idle {
  display: none;
}

.eidoc-bottom-nav__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: min(100%, calc(100vw - 5rem));
  padding: 0.375rem 0.75rem 0.375rem 0.625rem;
  border-radius: var(--ui-radius-pill, 9999px);
  background: var(--ui-color-surface, #fff);
  color: var(--brand-blue, #1d4ed8);
  box-shadow: var(--ui-shadow-sm, 0 1px 3px rgba(15, 23, 42, 0.08));
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.eidoc-bottom-nav__pill-label {
  text-align: center;
}

.eidoc-bottom-nav__icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--ui-radius-pill, 9999px);
  color: rgba(255, 255, 255, 0.92);
  transition: color 0.15s ease, transform 0.2s ease, filter 0.2s ease;
}

.eidoc-bottom-nav__icon-btn:hover {
  color: #fff;
}

.eidoc-bottom-nav__icon-btn i {
  font-size: 1.125rem;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.eidoc-bottom-nav__icon-btn:hover i {
  transform: scale(1.1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28));
}

.eidoc-bottom-nav__badge {
  position: absolute;
  top: 0.125rem;
  right: 0.125rem;
  min-width: 0.875rem;
  height: 0.875rem;
  padding: 0 0.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ui-radius-pill, 9999px);
  background: var(--ui-color-danger, #dc2626);
  color: #fff;
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1;
  border: 2px solid var(--brand-blue, #1d4ed8);
}

.eidoc-bottom-nav__pill .eidoc-bottom-nav__badge {
  top: -0.375rem;
  right: -0.375rem;
  border-color: var(--ui-color-surface, #fff);
}

.eidoc-bottom-nav__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--ui-radius-pill, 9999px);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid color-mix(in srgb, var(--brand-blue, #1d4ed8) 22%, transparent);
}

.eidoc-bottom-nav__icon-btn .eidoc-bottom-nav__avatar {
  border-color: rgba(255, 255, 255, 0.45);
  opacity: 0.95;
}

.eidoc-bottom-nav__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eidoc-bottom-nav__profile-trigger {
  display: flex;
  width: 100%;
  min-width: 0;
  justify-content: center;
  align-items: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.eidoc-bottom-nav__profile-trigger:active {
  transform: scale(0.96);
}

.eidoc-bottom-nav__pill--profile {
  padding-left: 0.375rem;
}

@media (prefers-reduced-motion: reduce) {
  .eidoc-bottom-nav__bar,
  .eidoc-bottom-nav__slot,
  .eidoc-bottom-nav__icon-btn i {
    transition: none;
  }
  .eidoc-bottom-nav__icon-btn:hover i {
    transform: none;
    filter: none;
  }
}

/*
 * Публичный shell: нижняя панель в цветах Foundation sidebar (navy + тонкая граница).
 * При открытом мобильном drawer убираем светлую 1px обводку shell (визуальный зазор у края).
 */
body.eidoc-public .eidoc-bottom-nav__shell {
  border-color: var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
  background: var(--ui-sidebar-bg, #0b1f3a);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
}

body.eidoc-public .eidoc-bottom-nav__profile-panel,
body.eidoc-public .bottom-nav-profile-panel {
  color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
  background: var(--ui-sidebar-bg, #0b1f3a);
  border-bottom-color: var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
}

body.eidoc-public .eidoc-bottom-nav__profile-name,
body.eidoc-public .bottom-nav-profile-name {
  color: rgba(255, 255, 255, 0.95);
  border-bottom-color: var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
}

body.eidoc-public .eidoc-bottom-nav__profile-item,
body.eidoc-public .bottom-nav-profile-item {
  color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
}

body.eidoc-public .eidoc-bottom-nav__profile-item:hover,
body.eidoc-public .eidoc-bottom-nav__profile-item:focus-visible,
body.eidoc-public .bottom-nav-profile-item:hover,
body.eidoc-public .bottom-nav-profile-item:focus-visible {
  background: var(--ui-sidebar-hover-bg, #1e293b);
  color: #fff;
}

body.eidoc-public .eidoc-bottom-nav__profile-item i,
body.eidoc-public .bottom-nav-profile-item i {
  color: rgba(255, 255, 255, 0.72);
}

body.eidoc-public .eidoc-bottom-nav__profile-item:hover i,
body.eidoc-public .eidoc-bottom-nav__profile-item:focus-visible i,
body.eidoc-public .bottom-nav-profile-item:hover i,
body.eidoc-public .bottom-nav-profile-item:focus-visible i {
  color: #fff;
}

.eidoc-bottom-nav__profile-name .eidoc-profile-verified-icon,
body.eidoc-public .eidoc-bottom-nav__profile-name .eidoc-profile-verified-icon {
  color: #10b981 !important;
}

body.eidoc-public .eidoc-bottom-nav__profile-divider {
  border-top-color: var(--ui-sidebar-border, rgba(255, 255, 255, 0.06));
}

body.eidoc-public .eidoc-bottom-nav__bar {
  background: var(--ui-sidebar-bg, #0b1f3a);
  color: var(--ui-sidebar-text, rgba(255, 255, 255, 0.82));
}

body.eidoc-public .eidoc-bottom-nav__pill {
  background: var(--ui-sidebar-active-bg, #1d4ed8);
  color: #fff;
  box-shadow: none;
}

body.eidoc-public .eidoc-bottom-nav__pill-label {
  color: inherit;
}

body.eidoc-public .eidoc-bottom-nav__pill .eidoc-bottom-nav__badge {
  border-color: var(--ui-sidebar-active-bg, #1d4ed8);
}

body.eidoc-public .eidoc-bottom-nav__icon-btn {
  color: rgba(255, 255, 255, 0.88);
}

body.eidoc-public .eidoc-bottom-nav__badge {
  border-color: var(--ui-sidebar-bg, #0b1f3a);
}

body.eidoc-public .eidoc-bottom-nav__avatar {
  border-color: rgba(255, 255, 255, 0.28);
}

@media (max-width: 1023px) {
  body.eidoc-public .eidoc-app-shell:has(#left-sidebar-toggle:checked) .eidoc-bottom-nav__shell {
    border: none;
    box-shadow: none;
  }
}
