/* Figma: 62:4730 / 242:38087 / 22:6947. Локальная оболочка общей шапки. */
header.site-header, .site-account-menu, .site-account-backdrop {
    --color-focus: #9BA7FD;
    --color-surface-muted: #F0F0F0;
}
header.site-header {
    padding: 10px 20px;
    border-radius: 12px;
    background: #fff;
    color: #000;
}
.site-header, .site-header * { box-sizing: border-box; }
/* kit.css анимирует all: обводку фокуса переключаем сразу, без чёрного перехода. */
.site-header :is(a, button, input),
.site-account-menu :is(a, button),
.site-navigation :is(a, button),
.site-search :is(a, button, input) { transition-property: color, background-color, border-color; }
.site-header :is(a, button, input):focus-visible {
    outline: 2px solid var(--color-focus, #9BA7FD);
    outline-offset: 2px;
}
.site-header__row { display: flex; align-items: center; gap: 16px; min-height: 40px; }
.site-header__brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-right: 51px; }
.site-header .logo { display: block; width: 115px; height: 16px; margin: 0; float: none; flex-shrink: 0; }
.site-header__search {
    display: flex; align-items: center; gap: 10px; flex: 0 1 272px; min-width: 100px; height: 40px;
    margin: 0 32px 0 0; padding: 0 8px 0 16px; border-radius: 8px; background: #F0F0F0;
}
.site-header__search input {
    flex: 1; width: 100%; min-width: 0; height: 100%; padding: 0;
    border: 0; border-radius: 0; background: transparent; color: #000;
    font: 400 14px/24px 'Inter', sans-serif; letter-spacing: -.02em;
}
/* Поле поиска составное: рамка повторяет весь фон вместе с кнопкой поиска. */
.site-header__search:focus-within {
    outline: 2px solid var(--color-focus, #9BA7FD);
    outline-offset: 2px;
}
.site-header .site-header__search input:focus { outline: none; }
.site-header__search input::placeholder { color: #909090; opacity: 1; }
.site-header .site-header__search button, .site-header .site-header__search .ui-icon { width: 20px; height: 20px; }
.site-header .site-header__search button { flex-basis: 20px; }
.site-header .site-header__nav { display: flex; align-items: center; justify-content: flex-start; gap: 16px; margin: 0; padding: 0; white-space: nowrap; }
.site-header__nav a, .site-header__login { font: 400 14px/24px 'Inter', sans-serif; letter-spacing: -.02em; color: #000; }
.site-header__nav a { margin: 0; padding: 0; min-width: 0; }
.site-header--home .site-header__nav { position: absolute; left: 50%; transform: translateX(-50%); }
.site-header__actions { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: auto; flex-shrink: 0; }
/* Рамка Figma находится внутри: её 1 px включён в отступы 8 × 14 px. */
.site-header .site-header__button {
    display: inline-flex; justify-content: center; align-items: center; flex-shrink: 0;
    height: 40px; padding: 7px 13px; margin: 0; border: 1px solid #4C60F4; border-radius: 8px;
    background: #4C60F4; color: #fff; white-space: nowrap;
    font: 400 14px/24px 'Inter', sans-serif; letter-spacing: -.02em;
}
.site-header .site-header__button--ghost { background: transparent; color: #4C60F4; }
.site-header__add .ui-icon { display: none; }
.site-header .site-header__account {
    display: flex; align-items: center; gap: 8px; flex: 0 0 auto; max-width: 104px;
    margin: 0 0 0 8px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #000;
    font: 400 14px/normal 'Inter', sans-serif; cursor: pointer;
}
.site-header__avatar { display: block; flex: 0 0 24px; width: 24px; height: 24px; object-fit: cover; border-radius: 50%; }
.site-header__account[data-account-kind="company"] .site-header__avatar { border-radius: 4px; }
.site-header__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-header__login { display: flex; align-items: center; gap: 8px; }
.site-header .site-header__icon { display: flex; flex: 0 0 24px; align-items: center; justify-content: center; width: 24px; height: 24px; margin: 0; padding: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; }
.site-header .site-header__burger, .site-header .site-header__search-toggle { display: none; }
.site-header .site-header__submenus { margin: 0; }
.site-header .site-header__nav a[aria-expanded="true"] { color: #909090; }
.site-account-menu .settings-dialog__title { overflow-wrap: anywhere; }
#overlay.site-navigation { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: auto; }
#overlay.site-navigation[open] { display: block; }
.site-navigation__close { display: block; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.site-navigation :is(a,button):focus-visible { outline: 2px solid var(--color-focus, #9BA7FD); outline-offset: 2px; }
/* Полноэкранное меню: 68:4568 и 1119:70724 (375), 244:48618 (1024). */
@media (max-width: 1024px) {
    #overlay.site-navigation > .container {
        display: flex; flex-direction: column; box-sizing: border-box; min-height: 100%;
        padding-top: 20px;
        padding-bottom: max(32px, env(safe-area-inset-bottom));
    }
    #overlay.site-navigation .top { display: flex; align-items: center; justify-content: space-between; flex: none; }
    .site-navigation__brand { display: flex; align-items: center; gap: 8px; }
    #overlay.site-navigation .logo { margin: 0; }
    .site-navigation__pro-badge {
        box-sizing: border-box; width: 30px; height: 20px; margin-left: 8px; flex-shrink: 0;
        border: 1px solid #DEDEDE; border-radius: 6px;
        background: url("../images/header-pro-label.svg") center / 18px 8px no-repeat,
            linear-gradient(239deg, white, #C2C2C2) border-box;
    }
    #overlay.site-navigation .main-bottom a:has(.site-navigation__pro-badge) { display: flex; align-items: center; }
    #overlay.site-navigation div.submenu { margin: 27px 0 0; }
    #overlay.site-navigation div.submenu .menu a {
        display: flex; align-items: center; justify-content: space-between; padding: 12px 0;
    }
    #overlay.site-navigation div.submenu .menu .back { justify-content: flex-start; }
    #overlay.site-navigation div.submenu .menu .icon-big {
        flex: 0 0 32px; width: 32px; height: 32px; margin: 0; float: none;
    }
    #overlay.site-navigation .main-menu { display: flex; flex-direction: column; flex: 1 0 auto; height: auto; }
    #overlay.site-navigation .top-menu a { padding: 16px 0; }
    #overlay.site-navigation .top-menu a:last-child { padding-bottom: 0; }
    #overlay.site-navigation .main-bottom { position: static; margin-top: auto; padding-top: 16px; }
    #overlay.site-navigation .main-bottom a { padding: 12px 0; }
    #overlay.site-navigation .main-bottom a:first-child { padding-top: 0; }
    #overlay.site-navigation .main-bottom a:last-child { padding-bottom: 0; }
}
@media (min-width: 769px) and (max-width: 1024px) {
    #overlay.site-navigation .main-menu { margin-right: 12px; }
    .site-navigation__pro-badge { width: 27.27px; }
}
@media (max-width: 768px) {
    #overlay.site-navigation > .container {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    #overlay.site-navigation div.submenu .menu a {
        padding: 16px 0; font-size: 28px; line-height: 33px;
    }
    #overlay.site-navigation div.submenu .icon-arrow-right { display: none; }
    #overlay.site-navigation .top-menu a {
        display: flex; align-items: center; justify-content: space-between; line-height: 33px;
    }
    #overlay.site-navigation .top-menu .icon-big {
        float: none; width: 32px; height: 32px; margin: 0;
    }
}
@media (max-width: 1024px) {
    #overlay.site-navigation div.submenu .menu a:first-child { padding-top: 0; }
    #overlay.site-navigation div.submenu .menu a:last-child { padding-bottom: 0; }
}
@media (hover: hover) and (pointer: fine) {
    .site-header__account:hover, .site-header__login:hover { color: #4C60F4; }
    .site-header .site-header__button:hover { background: #344AF4; border-color: #344AF4; color: #fff; }
}
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    .site-header .site-header__button--ghost:hover {
        background: rgba(155, 167, 253, .2); border-color: #344AF4; color: #344AF4;
    }
}
/* Figma 209:22084 / 244:40719: полоса 60 px, строка 24 px по центру. */
@media (min-width: 1025px) {
    /* Figma 62:4731, 1470:69276 — ширина «Работ» во внутренних шапках и на главной без Pro после входа. */
    .site-header:not(.site-header--home) [data-site-submenu="works"],
    .site-header--home:has(.site-header__pro) [data-site-submenu="works"] {
        min-width: 59px; text-align: center;
    }
    header.site-header--submenu-open { border-radius: 12px 12px 0 0; }
    .site-header .site-header__submenus {
        display: block; position: absolute; z-index: 1; top: 100%; left: 0; width: 100%; height: 0;
        padding: 0 20px; overflow: clip; border-radius: 0 0 12px 12px;
        background: white; visibility: hidden;
        transition: height .2s ease, visibility 0s linear .2s;
    }
    .site-header--submenu-open .site-header__submenus {
        height: 60px; visibility: visible; transition-delay: 0s;
    }
    .site-header__submenus:has(.more-menu.open) { overflow: visible; }
    .site-header .site-header__submenus::before {
        top: 0; left: 0; width: 100%;
    }
    .site-header__submenus > .col-12 {
        position: relative; width: 100%; height: 60px;
    }
    .site-header__submenus .submenu-container {
        display: flex; align-items: center; justify-content: center; inset: 0;
        transform: none; opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity .3s ease, visibility 0s linear .3s;
    }
    .site-header__submenus .submenu-container.is-active {
        z-index: 1; opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s;
    }
    .site-header__submenus .menu2-item {
        display: flex; flex: 0 0 auto; align-items: center;
    }
    .site-header__submenus .menu2-item a,
    .site-header__submenus .more-menu a {
        font: 400 14px/24px 'Inter', sans-serif; letter-spacing: -.02em;
    }
    .site-header__submenus .icon-more { padding: 0; border: 0; background-color: transparent; }
    /* Figma 226:28404. */
    .site-header__submenus .more-menu {
        padding: 8px 12px; min-width: 140px; width: max-content;
    }
    .site-header__submenus .more-menu.align-end { left: auto; right: 0; }
    .site-header__submenus .more-menu li a { margin: 0; padding: 0; border: 0; }
    .site-header__submenus .more-menu li + li {
        margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0;
    }
    #overlay_menu.site-header-backdrop {
        display: block; opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity .2s ease, visibility 0s linear .2s;
    }
    #overlay_menu.site-header-backdrop.is-visible {
        opacity: .8; visibility: visible; pointer-events: auto; transition-delay: 0s;
    }
}
@media (min-width: 1025px) and (prefers-reduced-motion: reduce) {
    .site-header .site-header__submenus,
    .site-header__submenus .submenu-container,
    #overlay_menu.site-header-backdrop { transition: none; }
}
@media (min-width: 1025px) and (max-width: 1250px) {
    /* Производное: плавно сокращаем свободные интервалы между контрольными ширинами. */
    .site-header__brand { margin-right: 0; }
    .site-header__search { margin-right: 0; }
    .site-header__account { max-width: 80px; }
    .site-header--home .site-header__nav { position: static; margin-left: auto; transform: none; }
}
@media (max-width: 1024px) {
    header.site-header { padding: 10px 20px; }
    .site-header .site-header__burger { display: flex; }
    .site-header .site-header__nav { display: none; }
    .site-header__brand { margin-right: 0; }
    .site-header__search { position: absolute; left: 50%; transform: translateX(-50%); width: 44.07%; max-width: 416px; margin: 0; padding-left: 12px; }
    .site-header__actions { gap: 16px; }
    .site-header .site-header__account { width: 24px; max-width: 24px; margin: 0; }
    .site-header__name, .site-header__add span { display: none; }
    .site-header .site-header__add { width: 40px; height: 40px; padding: 0; border-radius: 6px; }
    .site-header__add .ui-icon { display: block; width: 20px; height: 20px; }
    .site-header .site-header__pro { font-size: 12px; line-height: 18px; letter-spacing: -.03em; padding: 2px 11px; border-radius: 6px; }
    .site-header .site-header__submenus { display: none !important; }
}
@media (min-width: 769px) and (max-width: 900px) {
    /* Производное: место для поиска без наложения на кнопки и логотип. */
    .site-header__search { position: static; transform: none; flex: 1; width: auto; min-width: 80px; }
}
@media (max-width: 768px) {
    header.site-header { padding: 18px 20px; }
    .site-header__row { min-height: 24px; gap: 8px; }
    .site-header__search, .site-header .site-header__pro, .site-header__login { display: none; }
    .site-header .site-header__search-toggle { display: flex; }
    .site-header .site-header__add { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: #4C60F4; color: white; }
    /* Производное для 320 px: сохраняем все иконки в одной строке. */
    .site-header__actions { gap: clamp(8px, calc((100vw - 320px) * .145 + 8px), 16px); }
}

/* Мобильный поиск: Figma 386:39102 / 386:39096. */
.site-search {
    box-sizing: border-box; position: fixed; inset: 0; margin: 0;
    width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none;
    padding: max(40px, env(safe-area-inset-top)) 16px 16px;
    border: 0; border-radius: 0; background: #F0F0F0; color: #000;
}
.site-search__row { display: flex; align-items: center; gap: 12px; }
.site-search__form { position: relative; flex: 1; min-width: 0; margin: 0; }
.site-search input {
    box-sizing: border-box; display: block; width: 100%; height: 44px;
    padding: 10px 44px 10px 16px; border: 0; border-radius: 12px;
    font: 400 14px/24px 'Inter', sans-serif; letter-spacing: -.02em;
    background: white; color: #000; caret-color: #4C60F4;
}
.site-search input::placeholder { color: #909090; opacity: 1; }
.site-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.site-search input:focus { outline: 2px solid #9BA7FD; outline-offset: 0; }
.site-search__close, .site-search__clear { padding: 0; border: 0; width: 24px; height: 24px; background: transparent; cursor: pointer; border-radius: 4px; }
.site-search__close { display: flex; align-items: center; justify-content: center; flex: 0 0 24px; }
.site-search__close .ui-icon { width: 24px; height: 24px; }
.site-search__clear { position: absolute; right: 12px; top: 10px; background-repeat: no-repeat; background-position: center; }
.site-search__clear[hidden] { display: none; }
.site-search button:focus-visible { outline: 2px solid #9BA7FD; outline-offset: 2px; }
/* Иконка очистки из существующего .clear-form в kit.css, без его AJAX-обработчика. */
.site-search__clear { background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0_383_30331)'%3E%3Cpath d='M12 19.5C8.13367 19.5 5 16.3663 5 12.5C5 8.63367 8.13367 5.5 12 5.5C15.8663 5.5 19 8.63367 19 12.5C19 16.3663 15.8663 19.5 12 19.5Z' fill='%239BA7FD'/%3E%3Cpath d='M15 9.5L9 15.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M15 15.5L9 9.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_383_30331'%3E%3Crect width='24' height='24' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A"); }
