.header-services {
    display: none;
}

@media (min-width: 1124px) {

    .panel-body.header__subnav.hide-items.header__submenu {
        display: none;
    }

    .header-services,
    .header-services * {
        box-sizing: border-box;
    }

    .header-services[hidden],
    .header-services [hidden] {
        display: none !important;
    }

    .header-services {
        position: fixed;
        inset: 10px 10px 40px;
        z-index: 99990;
        flex-direction: column;
        overflow: hidden;
        border-radius: 24px;
        background: #fff;
        color: #383838;
        box-shadow: 0 0 0 200vmax #0006, 0 12px 36px #0002;
    }

    .header-services.header-services--open {
        display: flex;
        animation: header-services-appear .3s ease both;
    }

    .header-services p {
        margin: 0;
    }

    .header-services :is(button, input) {
        font: inherit;
    }

    .header-services button {
        cursor: pointer;
    }

    .header-services a {
        text-decoration: none;
    }

    .header-services a,
    .header-services button,
    .header-services img {
        transition: color .3s ease, background-color .3s ease, border-color .3s ease, opacity .3s ease, transform .3s ease, box-shadow .3s ease;
    }

    .header-services button:focus-visible,
    .header-services a:focus-visible,
    .header-services input:focus-visible {
        outline: 2px solid #0185ca;
        outline-offset: 2px;
    }

    .header-services__top {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 40px 40px 32px;
        flex: none;
        border-bottom: 1px solid #d6e5ee;
        background: #fff;
    }

    .header-services__logo {
        flex: 0 0 13.35%;
        display: flex;
        align-items: center;
        margin-right: 24px;
    }

    .header-services__logo img {
        display: block;
        max-width: 100%;
        width: 15.2rem;
        height: auto;
    }

    .header-services__search {
        position: relative;
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
        border: 1px solid #d6d6d6;
        border-radius: 10px;
        background: #fff;
    }

    .header-services__search:focus-within {
        border-color: #0185ca;
    }

    .header-services__search-input {
        flex: 1;
        min-width: 0;
        border: 0;
        background: transparent;
        outline: none;
        padding: 16px 18px;
        color: #383838;
        font-size: 18px;
        line-height: 1.5;
    }

    .header-services__search-input::placeholder {
        color: #656565;
        opacity: 1;
    }

    .header-services__search-input::-webkit-search-cancel-button {
        display: none;
    }

    .header-services__search-icon {
        flex: none;
        width: 1.25rem;
        height: 1.25rem;
        margin-right: 16px;
    }

    .header-services__search-reset {
        flex: none;
        border: 0;
        padding: 10px 12px;
        background: transparent;
        color: #0185ca;
        font-size: 15px;
    }

    .header-services__search-reset span {
        font-size: 20px;
    }

    .header-services__close {
        flex: none;
        display: grid;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: none;
    }

    .header-services__close img {
        display: block;
        width: 3.8rem;
        height: auto;
    }

    .header-services__close:hover {
        transform: rotate(90deg);
    }

    .header-services__layout {
        display: grid;
        grid-template-columns: minmax(0, 20%) minmax(0, 60%) minmax(0, 20%);
        flex: 1;
        min-height: 0;
    }

    .header-services__sidebar {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 20px;
        min-height: 0;
        padding: 12px;
        overflow-y: auto;
        background: #f1f6fa;
        border-right: 1px solid #c6dde9;
    }

    .header-services__categories {
        display: flex;
        flex-direction: column;
    }

    .header-services__category {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        padding: 20px;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: #383838;
        text-align: left;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.3;
    }

    .header-services__category:hover {
        background: #dceef7;
    }

    .header-services__category--active,
    .header-services__category--active:hover {
        background: #007bb3;
        box-shadow: 0 2px 8px #0002;
        color: #fff;
    }

    .header-services__category-icon {
        flex: none;
        width: 1.25rem;
        height: 1.25rem;
        object-fit: contain;
    }

    .header-services__category--active .header-services__category-icon {
        filter: brightness(0) invert(1);
    }

    .header-services__category span {
        flex: 1;
    }

    .header-services__category-arrow {
        flex: none;
        width: .6rem;
        height: .75rem;
        object-fit: contain;
    }

    .header-services__category--active .header-services__category-arrow {
        filter: brightness(0) invert(1);
    }

    .header-services__all-services {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 20px;
        border-radius: 12px;
        background: #0185ca;
        color: #fff;
        font-size: 18px;
        font-weight: 600;
        line-height: 1.3;
    }

    .header-services__all-services:hover {
        background: #007bb3;
    }

    .header-services__all-services img {
        flex: none;
        width: 1rem;
        height: 1rem;
    }

    .header-services__center {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 24px;
        min-width: 0;
        min-height: 0;
        overflow-y: auto;
        padding: 32px 40px;
        background: #fff;
    }

    .header-services__service-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
    }

    .header-services__service-intro {
        flex: 1;
        min-width: 0;
    }

    .header-services__service-title,
    .header-services__consult-title {
        color: #383838;
        font-size: 28px;
        font-weight: 700;
        line-height: 1.3;
    }

    .header-services__service-subtitle {
        margin-top: 12px !important;
        color: #656565;
        font-size: 14px;
        line-height: 20px;
    }

    .header-services__sort {
        position: relative;
        flex: none;
    }

    .header-services__sort-button {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 25px;
        padding: 12px 16px;
        border: 1px solid #0185ca;
        border-radius: 8px;
        background: #fff;
        color: #383838;
        font-size: 16px;
        font-weight: 600;
    }

    .header-services__sort-caret {
        display: block;
        width: .5em;
        height: .5em;
        border-right: 1.5px solid #383838;
        border-bottom: 1.5px solid #383838;
        transform: rotate(45deg);
    }

    .header-services__sort-button[aria-expanded="true"] .header-services__sort-caret {
        transform: rotate(225deg);
    }

    .header-services__sort-options {
        position: absolute;
        top: calc(100% + 4px);
        right: 0;
        z-index: 2;
        display: grid;
        gap: 4px;
        min-width: 100%;
        padding: 4px;
        border: 1px solid #add9f0;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 10px 12px #0001;
    }

    .header-services__sort-option {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 18px;
        border: 0;
        border-radius: 4px;
        padding: 10px 12px;
        background: #fff;
        color: #0185ca;
        font-size: 16px;
        font-weight: 600;
    }

    .header-services__sort-option span {
        visibility: hidden;
    }

    .header-services__sort-option--selected {
        background: #eef5ff;
        color: #383838;
    }

    .header-services__sort-option--selected span {
        visibility: visible;
        color: #0185ca;
    }

    /* Заполняем три колонки по строкам, без динамического repeat() */
    .header-services__service-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-flow: row;
        gap: 0 24px;
        align-content: start;
        margin-top: 28px;
    }

    .header-services__service {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-width: 0;
        padding: 16px 12px;
        border-top: 1px solid #e3f0f7;
        color: #383838;
        font-size: 16px;
        font-weight: 600;
        line-height: 1.3;
    }

    .header-services__service:nth-last-child(-n + 3) {
        border-bottom: 1px solid #e3f0f7;
    }

    .header-services__service:hover {
        background: #eef7fc;
        color: #383838;
    }

    .header-services__service-name {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .header-services__service-arrow {
        flex: none;
        width: 1rem;
        height: 1rem;
    }

    .header-services__offers {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .header-services__offers-titlebar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
    }

    .header-services__offers-heading {
        color: #383838;
        font-size: 24px;
        font-weight: 700;
        line-height: 1.3;
    }

    .header-services__offers-titlebar a {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #0185ca;
        font-size: 18px;
        font-weight: 600;
        text-decoration: underline;
    }

    .header-services__offers-titlebar a img {
        width: 1rem;
        height: 1rem;
    }

    .header-services__offers-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .header-services__offer {
        display: flex;
        flex-direction: column;
        gap: 16px;
        min-width: 0;
        padding: 20px;
        border: 1px solid #63b8da;
        border-radius: 12px;
        background: #def3fb;
        color: #383838;
    }

    .header-services__offer:hover {
        transform: translateY(-3px);
    }

    .header-services__offer--yellow {
        border-color: #e4b765;
        background: #fff0d1;
    }

    .header-services__offer-head {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 18px;
        font-weight: 600;
    }

    .header-services__offer-head strong {
        font-weight: 600;
    }

    .header-services__offer-discount {
        flex: none;
        padding: 8px;
        border-radius: 8px;
        background: #cceaf8;
        color: #0185ca;
        white-space: nowrap;
    }

    .header-services__offer--yellow .header-services__offer-discount {
        background: #ffe4af;
        color: #704a0c;
    }

    .header-services__offer-description {
        color: #4d4d4d;
        font-size: 14px;
        line-height: 20px;
    }

    .header-services__offer-link {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #0185ca;
        font-size: 14px;
        font-weight: 600;
    }

    .header-services__offer-link img {
        width: .6rem;
        height: .8rem;
    }

    .header-services__consult {
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 32px 31px 20px;
        overflow: hidden;
        background: #edf6fb;
        border-left: 1px solid #c6dde9;
    }

    .header-services__consult-top {
        flex: none;
    }

    .header-services__consult-top p {
        margin-top: 12px;
        color: #4d4d4d;
        font-size: 14px;
        line-height: 20px;
    }

    .header-services__doctor {
        position: relative;
        display: flex;
        flex: 1;
        align-items: flex-end;
        justify-content: center;
        min-height: 0;
        margin: 22px -31px 0;
        overflow: hidden;
    }

    .header-services__doctor::before,
    .header-services__doctor::after {
        content: '';
        position: absolute;
        bottom: -14%;
        width: 78%;
        aspect-ratio: 1;
        border-radius: 50%;
        background: #d7ecf6;
    }

    .header-services__doctor::before {
        left: -35%;
    }

    .header-services__doctor::after {
        right: -35%;
    }

    .header-services__doctor img {
        position: relative;
        z-index: 1;
        display: block;
        max-height: 100%;
        max-width: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
        object-position: bottom;
    }

    .header-services__consult-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding-top: 13px;
    }

    .header-services__consult-button {
        border: 0;
        border-radius: 8px;
        padding: 16px 12px;
        background: #ffdf9d;
        color: #383838;
        font-size: 16px;
        font-weight: 600;
        text-align: center;
        line-height: 1.3;
    }

    .header-services__consult-button:hover {
        background: #ffd07e;
    }

    .header-services__chat {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        align-self: center;
        padding: 0;
        border: 0;
        background: transparent;
        color: #0185ca;
        font-size: 16px;
        font-weight: 600;
        text-decoration: underline;
    }

    .header-services__chat img {
        width: .6rem;
        height: .8rem;
    }

    .header-services__consult-caption {
        position: relative;
        flex: none;
        margin-top: auto !important;
        padding-top: 32px;
        text-align: center;
        color: #383838;
        font-size: 14px;
    }

    .header-services__consult-caption::before {
        content: 'ⓘ';
        margin-right: 6px;
        color: #0185ca;
    }

    .header-services__empty {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        align-self: center;
        gap: 18px;
        padding: 50px 30px;
        text-align: center;
    }

    .header-services__empty>img {
        width: 4rem;
        height: 4rem;
    }

    .header-services__empty-title {
        font-size: 32px;
        font-weight: 700;
    }

    .header-services__empty p {
        color: #656565;
        font-size: 18px;
    }

    .header-services__empty-actions {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        margin-top: 14px;
    }

    .header-services__back,
    .header-services__help {
        border: 1px solid #0185ca;
        border-radius: 8px;
        padding: 16px 24px;
        background: #fff;
        color: #0185ca;
        font-size: 16px;
        font-weight: 600;
    }

    .header-services__help {
        background: #0185ca;
        color: #fff;
    }

    .header-services__back:hover {
        background: #eef7fc;
    }

    .header-services__help:hover {
        background: #007bb3;
    }

    .header-services--empty .header-services__layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .header-services--empty :is(.header-services__sidebar, .header-services__center, .header-services__consult) {
        display: none;
    }

    @keyframes header-services-appear {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

@media (min-width: 1124px) and (max-height: 820px) {
    .header-services__top {
        padding: 20px 30px;
    }

    .header-services__center {
        padding: 24px 28px;
    }

    .header-services__category {
        padding: 12px 16px;
    }

    .header-services__all-services {
        padding: 16px;
    }

    .header-services__consult {
        padding: 24px 20px 16px;
    }

    .header-services__doctor {
        margin-right: -20px;
        margin-left: -20px;
    }

    .header-services__service-grid {
        margin-top: 18px;
    }

    .header-services__service {
        padding: 12px 8px;
    }

    .header-services__offer {
        padding: 14px;
        gap: 10px;
    }
}

@media (max-width: 1123px) {
    .header-services {
        display: none !important;
    }
}

@media (min-width: 1124px) {
    .header-services input:focus-visible {
        outline: 0px solid #0185ca;
        outline-offset: 0px;
    }

    main.blacked::after,
    footer.blacked::after {
        display: none;
    }

    .header-services__search:has(.header-services__search-reset:not([hidden])) .header-services__search-icon {
        display: none;
    }

    .header-services__center {
        scrollbar-gutter: stable;
    }
}


@media (min-width: 1124px) and (max-width: 1300px) {
    .header-services__service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}