@media (min-width: 992px) {
  .nav-item.mega-menu {
    position: static;
  }

  .nav-item.mega-menu:hover.dropdown > .dropdown-menu,
  .nav-item.mega-menu > .dropdown-menu {
    min-width: 0;
    max-height: none;
    overflow: visible;
  }

  .nav-item.mega-menu > .dropdown-menu {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--services-mega-top, 120px);
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: #fff;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.3);
    z-index: 2147483647;
    animation: none;
  }

  body.services-mega-menu-open .nav-menu {
    z-index: 2147483647 !important;
  }

  body.services-mega-menu-open .footer-widgets,
  body.services-mega-menu-open [class*="hoverArea"],
  body.services-mega-menu-open .fortuneclick,
  body.services-mega-menu-open .consult-widget,
  body.services-mega-menu-open .tg-widget,
  body.services-mega-menu-open jdiv,
  body.services-mega-menu-open #jivo-iframe-container,
  body.services-mega-menu-open #jivo_custom_widget {
    z-index: 1 !important;
    pointer-events: none;
  }

  .nav-item.mega-menu > .dropdown-menu::after {
    display: none;
  }

  .nav-item.mega-menu:not(.is-open) > .dropdown-menu {
    display: none !important;
  }

  .nav-item.mega-menu.is-open > .dropdown-menu {
    display: block;
  }

  .nav-item.mega-menu > .dropdown-menu > ul.list-unstyled {
    display: none;
  }

  .services-mega {
    display: flex;
    align-items: stretch;
    gap: 40px;
    height: min(700px, calc(100vh - var(--services-mega-top, 120px)));
    max-height: calc(100vh - var(--services-mega-top, 120px));
    min-height: 400px;
    padding-right: max(20px, calc((100vw - 1320px) / 2 + 15px));
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
    overflow: hidden;
  }

  .services-mega__sidebar {
    flex: 0 0 auto;
    align-self: stretch;
    background: #f3f6f5;
    padding: 40px 20px 40px max(20px, calc((100vw - 1320px) / 2 + 15px));
    display: flex;
    flex-direction: column;
    gap: 40px;
    box-sizing: border-box;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .services-mega__sidebar-title {
    margin: 0;
    flex: 0 0 auto;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: #8f9295;
  }

  .services-mega__categories {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 265px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1 1 auto;
  }

  .services-mega__category {
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .services-mega__category-btn {
    width: 100%;
    min-height: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: #222;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
  }

  .services-mega__category-btn span {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 239px;
  }

  .services-mega__category-btn svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    color: #dfe0e1;
    transition: color 0.2s ease;
  }

  /* Активный пункт (только по клику): зелёный + линия снизу */
  .services-mega__category.is-active .services-mega__category-btn {
    color: #0a7364;
    border-bottom: 1px solid #0a7364;
    padding-bottom: 2px;
  }

  .services-mega__category.is-active .services-mega__category-btn svg {
    color: #0a7364;
  }

  /* Наведение (не активный): синий, без линии — панель не переключается */
  .services-mega__category:not(.is-active):hover .services-mega__category-btn {
    color: #308bb6;
    border-bottom-color: transparent;
    padding-bottom: 0;
  }

  .services-mega__category:not(.is-active):hover .services-mega__category-btn svg {
    color: #308bb6;
  }

  .services-mega__category.is-active:hover .services-mega__category-btn {
    color: #0a7364;
    border-bottom: 1px solid #0a7364;
  }

  .services-mega__category.is-active:hover .services-mega__category-btn svg {
    color: #0a7364;
  }

  .services-mega__content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 40px 40px 0;
    display: flex;
    flex-direction: column;
    gap: 40px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .services-mega__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    min-height: 40px;
    flex: 0 0 auto;
  }

  .services-mega__title-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #222;
    text-decoration: none;
    font-size: 32px;
    font-weight: 600;
    line-height: 1;
  }

  .services-mega__title-link:hover {
    color: #0a7364;
    text-decoration: none;
  }

  .services-mega__title-link svg {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    color: #dfe0e1;
  }

  .services-mega__close {
    width: 40px;
    height: 40px;
    border: 1px solid #d5d6d9;
    border-radius: 50%;
    background: #fff;
    color: #d5d6d9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex: 0 0 40px;
    transition: border-color 0.2s ease, color 0.2s ease;
  }

  .services-mega__close:hover {
    border-color: #8f9295;
    color: #8f9295;
  }

  .services-mega__panels {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 40px;
    -webkit-overflow-scrolling: touch;
  }

  .services-mega__panel {
    display: none;
    gap: 40px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
  }

  .services-mega__panel.is-active {
    display: flex;
    padding-bottom: 8px;
  }

  .services-mega__column {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
  }

  .services-mega__section {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .services-mega__section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
  }

  .services-mega__section-title--featured {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #e3701e;
  }

  .services-mega__section-title--featured::before {
    content: "⚡";
    font-size: 18px;
    line-height: 1;
  }

  .services-mega__section-title--featured-dark {
    color: #333;
  }

  .services-mega__section-heading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .services-mega__section-heading:hover {
    color: #308bb6;
    text-decoration: none;
  }

  .services-mega__section-heading svg {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    color: #dfe0e1;
    transition: color 0.2s ease;
  }

  .services-mega__section-heading:hover svg {
    color: #308bb6;
  }

  .services-mega__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .services-mega__link {
    display: block;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .services-mega__link:hover {
    color: #308bb6;
    text-decoration: none;
  }

  .services-mega__link.is-accent {
    color: #308bb6;
  }

  .services-mega__link.is-accent:hover {
    color: #0a7364;
  }
}

/* ---------- Mobile: меню услуг ---------- */
@media (max-width: 991px) {
  .main-menu__nav .nav-item.mega-menu.open > a,
  .main-menu__nav .nav-item.mega-menu.open > .nav-link {
    color: #0a7364 !important;
  }

  .main-menu__nav .nav-item.mega-menu.open > .dropdown-button {
    transform: rotate(-180deg);
    filter: brightness(0) saturate(100%) invert(33%) sepia(61%) saturate(742%) hue-rotate(124deg) brightness(92%) contrast(92%);
  }

  .nav-item.mega-menu > .dropdown-menu {
    position: static;
    display: none;
    width: 100%;
    left: auto;
    right: auto;
    top: auto;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }

  .nav-item.mega-menu.open > .dropdown-menu,
  .nav-item.mega-menu.is-open > .dropdown-menu {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .nav-item.mega-menu > .dropdown-menu > ul.list-unstyled {
    display: none !important;
  }

  .nav-item.mega-menu .services-mega--desktop {
    display: none !important;
  }

  .services-mega--mobile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
  }

  .services-mega__mobile-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 4px 0;
    background: #f3f6f5;
    box-sizing: border-box;
  }

  .services-mega__mobile-item {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .services-mega__mobile-panel {
    display: none;
    width: 100%;
    padding: 4px 0;
    background: #f3f6f5;
    box-sizing: border-box;
  }

  .services-mega__mobile-item.is-open > .services-mega__mobile-panel {
    display: block;
  }

  .services-mega__mobile-item.is-open > .services-mega__mobile-nav-item {
    background: rgba(10, 115, 100, 0.12);
    color: #0a7364;
  }

  .services-mega__mobile-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding-bottom: 24px;
  }

  .services-mega__mobile-section {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .services-mega__mobile-label {
    padding: 4px 16px;
    font-size: 11px;
    font-weight: 500;
    line-height: 8px;
    color: #999;
  }

  .services-mega__mobile-label--featured {
    display: flex;
    align-items: center;
    gap: 2px;
    font-weight: 700;
    color: #e3701e;
  }

  .services-mega__mobile-label--featured::before {
    content: "⚡";
    font-size: 11px;
    line-height: 1;
  }

  .services-mega__mobile-label--featured-dark {
    color: #333;
    font-weight: 600;
  }

  .services-mega__mobile-link {
    display: block;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 400;
    line-height: 12px;
    color: #333;
    text-decoration: none;
    box-sizing: border-box;
  }

  .services-mega__mobile-link:active,
  .services-mega__mobile-link:hover {
    color: #333;
    text-decoration: none;
  }

  .services-mega__mobile-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 32px;
    padding: 9px 16px;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    line-height: 12px;
    color: #333;
    box-sizing: border-box;
  }

  .services-mega__mobile-nav-item.is-active {
    color: #0a7364;
  }

  .services-mega__mobile-nav-item span {
    flex: 1 1 auto;
    min-width: 0;
  }

  .services-mega__mobile-nav-item .services-mega__caret {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    color: #8f9295;
    transition: transform 0.2s ease, color 0.2s ease;
  }

  .services-mega__mobile-nav-item.is-active .services-mega__caret {
    transform: rotate(-90deg);
    color: #0a7364;
  }
}

@media (min-width: 992px) {
  .nav-item.mega-menu .services-mega--mobile {
    display: none !important;
  }
}
