/* MSW contact layout 1.0.7 — scoped to existing contact components. */
html[data-msw-layout-ready] {
  scroll-padding-bottom: calc(var(--msw-layout-reserve, 0px) + 16px);
}
html[data-msw-layout-ready] body {
  padding-bottom: max(var(--msw-layout-original-padding, 0px), var(--msw-layout-reserve, 0px)) !important;
}
html[data-msw-layout-ready] .mswcp-mobile-spacer { display: none !important; }
[data-msw-layout-suppressed], [data-msw-layout-duplicate] {
  visibility: hidden !important;
  pointer-events: none !important;
}
html[data-msw-layout-ready] :is(#callnowbutton, #msw-onecall-button) {
  z-index: 2147483000 !important;
}
html[data-msw-layout-ready] [data-msw-layout-call] { bottom: var(--msw-layout-call-bottom, 0px) !important; }
html[data-msw-layout-ready] :is(.mswcp-overlay, .mswneon-overlay) {
  z-index: 2147483100 !important;
}
html[data-msw-layout-ready] :is(.mswcp-panel, #msw-malta-panel, #mswneon-panel, .mswpc62-panel) {
  z-index: 2147483200 !important;
}
html[data-msw-layout-ready] :is(.mswcp-close, .mswpc62-close, .msw-v3-close, .msw-qm-close) {
  min-width: 44px !important;
  width: 44px !important;
  min-height: 44px !important;
  height: 44px !important;
  flex-shrink: 0;
}
html[data-msw-layout-ready] .mswcp-tab {
  box-sizing: border-box;
  min-height: 44px !important;
}
html[data-msw-layout-ready][data-msw-layout-main] details.msw-mobile-nav > summary {
  box-sizing: border-box;
  min-height: 44px !important;
}
html[data-msw-layout-ready][data-msw-layout-main] label.msw-consent {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 44px !important;
}
html[data-msw-layout-ready] :is(#msw-v3-dialog, #msw-quick-contact, #msw-contact, #msw-service, #mswcm-lead-dialog) {
  box-sizing: border-box;
  max-width: calc(100vw - 24px);
  max-height: calc(var(--msw-layout-vh, 100dvh) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
html[data-msw-layout-ready] :is(#msw-v3-dialog, #msw-quick-contact, #msw-contact, #msw-service, #mswcm-lead-dialog) button {
  min-height: 44px;
}
html[data-msw-layout-ready] [data-msw-layout-floating] {
  bottom: var(--msw-layout-float-bottom) !important;
  z-index: 2147483010 !important;
}
html[data-msw-layout-ready] #mswpc62-chat:has(.mswpc62-panel:not([hidden])),
html[data-msw-layout-ready] #msw-malta-ui:has(#msw-malta-panel:not([hidden])) {
  z-index: 2147483200 !important;
}
@media (min-width: 992px) {
  html[data-msw-layout-ready] .mswpc38-dock[data-msw-layout-desktop-callout] {
    box-sizing: border-box;
    top: auto !important;
    right: auto !important;
    bottom: var(--msw-layout-desktop-bottom, 12px) !important;
    left: 12px !important;
    width: max-content !important;
    max-width: calc(100vw - 24px) !important;
    margin: 0 !important;
    transform: none !important;
    flex-direction: row !important;
    align-items: stretch;
    gap: 8px !important;
    z-index: 2147483001 !important;
  }
  html[data-msw-layout-ready] .mswpc38-dock[data-msw-layout-desktop-callout] > a {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    line-height: 1.3;
  }
}
@media (max-width: 991px) {
  html[data-msw-layout-ready] #msw-premium .msw-header { gap: 8px; }
  html[data-msw-layout-ready] #msw-premium .msw-header .brand { min-width: 0; flex: 1 1 auto; }
  html[data-msw-layout-ready] #msw-premium .msw-header .brand > span:last-child { min-width: 0; }
  html[data-msw-layout-ready] #msw-premium .msw-header .brand small { white-space: normal; overflow-wrap: anywhere; }
  html[data-msw-layout-ready] #msw-premium .msw-header .menu-toggle {
    box-sizing: border-box; min-width: 44px; min-height: 44px; flex: 0 0 44px; padding: 4px;
  }
  html[data-msw-layout-ready] :is(#msw-v3-dialog, #msw-quick-contact, #msw-contact, #msw-service, #mswcm-lead-dialog)[open] {
    position: fixed !important;
    top: calc(var(--msw-layout-vtop, 0px) + max(12px, env(safe-area-inset-top, 0px))) !important;
    bottom: auto !important;
    margin-block: 0 !important;
    max-height: calc(var(--msw-layout-vh, 100dvh) - max(12px, env(safe-area-inset-top, 0px)) - 12px) !important;
  }
  html[data-msw-layout-ready] :is(#callnowbutton, #msw-onecall-button)[data-msw-layout-call] {
    box-sizing: border-box !important;
    inset: auto 0 var(--msw-layout-call-bottom, 0px) 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: calc(52px + var(--msw-layout-call-safe, 0px)) !important;
    min-height: 52px !important;
    padding: 0 max(12px, env(safe-area-inset-right, 0px)) var(--msw-layout-call-safe, 0px) max(12px, env(safe-area-inset-left, 0px)) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    font-size: 20px !important;
    line-height: 1.2 !important;
    transform: none !important;
  }
  html[data-msw-layout-ready] [data-msw-layout-bar] {
    box-sizing: border-box !important;
    position: fixed !important;
    top: auto !important;
    left: max(8px, env(safe-area-inset-left, 0px)) !important;
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
    bottom: var(--msw-layout-bar-bottom) !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 2147483001 !important;
  }
  html[data-msw-layout-ready] .mswcp-root[data-msw-layout-bar] .mswcp-dock {
    display: grid !important;
    grid-template-columns: repeat(var(--mswcp-count, 4), minmax(0, 1fr)) !important;
    flex-direction: row !important;
    min-width: 0 !important;
    width: 100% !important;
    gap: 6px !important;
    padding: 7px !important;
    border: 1px solid rgba(112, 218, 242, .32) !important;
    border-radius: 16px !important;
  }
  html[data-msw-layout-ready] .mswcp-root[data-msw-layout-bar] :is(.mswcp-mini-link, .mswcp-main-trigger, .mswcp-ai-launch) {
    box-sizing: border-box !important;
    display: flex;
    min-width: 0 !important;
    width: 100% !important;
    min-height: 48px !important;
    height: auto !important;
    padding: 5px 2px !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 3px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    border-radius: 11px !important;
    white-space: normal !important;
  }
  html[data-msw-layout-ready] .mswcp-root[data-msw-layout-bar] :is(.mswcp-mini-link, .mswcp-main-trigger, .mswcp-ai-launch) span {
    font-size: 11px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere;
  }
  html[data-msw-layout-ready] .mswpc38-dock[data-msw-layout-bar] {
    flex-direction: row !important;
    padding: 6px !important;
    gap: 6px !important;
    border-radius: 14px !important;
  }
  html[data-msw-layout-ready] .mswpc38-dock[data-msw-layout-bar] > a {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 10px 6px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.3;
    text-align: center;
  }
  html[data-msw-layout-ready] .msw-contact-dock[data-msw-layout-bar] {
    padding: 7px !important;
    gap: 6px !important;
    border-radius: 16px !important;
  }
  html[data-msw-layout-ready] .msw-contact-dock[data-msw-layout-bar] > * {
    min-width: 0;
    min-height: 44px;
    font-size: 12px;
    text-align: center;
  }
  html[data-msw-layout-ready] :is(.mswcp-panel, #mswneon-panel, .mswpc62-panel) {
    box-sizing: border-box !important;
    position: fixed !important;
    top: calc(var(--msw-layout-vtop, 0px) + max(8px, env(safe-area-inset-top, 0px))) !important;
    bottom: auto !important;
    left: max(8px, env(safe-area-inset-left, 0px)) !important;
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(var(--msw-layout-vh, 100dvh) - max(8px, env(safe-area-inset-top, 0px)) - 8px) !important;
    transform: none !important;
  }
  html[data-msw-layout-ready] .mswcp-panel {
    height: calc(var(--msw-layout-vh, 100dvh) - max(8px, env(safe-area-inset-top, 0px)) - 8px) !important;
    border-radius: 18px !important;
  }
  html[data-msw-layout-ready] .mswcp-panel-scroll {
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    -webkit-overflow-scrolling: touch;
  }
  html[data-msw-layout-ready] :is(#mswneon-panel, .mswpc62-panel) {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    border-radius: 18px !important;
  }
  html[data-msw-layout-ready] :is(.mswcp-panel, .mswcp-inline-form, #msw-v3-dialog, #msw-quick-contact, #msw-contact, #msw-service, #mswcm-lead-dialog, #msw-malta-panel, #mswneon-panel, .mswpc62-panel) :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
    font-size: 16px !important;
    min-height: 44px;
    max-width: 100%;
    scroll-margin-block: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html[data-msw-layout-ready] :is([data-msw-layout-bar], [data-msw-layout-floating]) { transition: none !important; }
}

/* Atlas hero grid: native input intrinsic size must not widen a narrow viewport. */
html[data-msw-layout-main] .msw97-hero > * {
  min-width: 0;
  max-width: 100%;
}

/* MSW96: the anonymous hero grid item retained min-width:auto.
 * CUA at 360px: a 350.672px track overflowed its 315px hero container.
 * Let direct items shrink; preserve the template's existing column breakpoints.
 */
html[data-msw-layout-ready][data-msw-layout-main] #msw96 .msw96-hero > * {
  min-width: 0;
}

/* SPA page only. Keep Copy in the left part of its inline preview header,
 * clear of the fixed Malta launcher at the right edge. No dialog-state changes.
 */
html[data-msw-layout-ready][data-msw-layout-main] #mswspa-app .spv-previewpanel > .spv-panel-head {
  justify-content: flex-start;
  flex-wrap: wrap;
  flex-shrink: 0;
  gap: 8px;
}
html[data-msw-layout-ready][data-msw-layout-main] #mswspa-app #mswspa-copy {
  order: -1;
  flex: 0 0 auto;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  font-size: 11px;
}

/* Let search surrender width before the 44px controls can leave the header. */
html[data-msw-layout-ready][data-msw-layout-main] #mswspa-app .spv-top-search {
  min-width: 0;
}
html[data-msw-layout-ready][data-msw-layout-main] #mswspa-app #mswspa-menu-toggle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
}
html[data-msw-layout-ready][data-msw-layout-main] #mswspa-app .spv-newticket {
  min-height: 44px;
  flex-shrink: 0;
}
html[data-msw-layout-ready][data-msw-layout-main] #mswspa-app .spv-topbar {
  min-height: 59px;
}
@media (max-width: 700px) {
  html[data-msw-layout-ready][data-msw-layout-main] #mswspa-app .spv-topbar {
    min-height: 57px;
  }
}

/* Measured menu and phone controls. Keep each template's visibility breakpoints. */
html[data-msw-layout-ready][data-msw-layout-main] :is(
  #v360-root #v360-menu,
  #v360-root .v360-top-call,
  #mswgutter-root #gt-menu-toggle,
  #mswgutter-root .gt-top-phone,
  #msw-lock-tech #mlt-nav-toggle,
  #mswauto-root #auto-menu-toggle,
  #mswauto-root .auto-top-phone,
  #mmt360 #mmt-menu,
  #mmt360 .mmt-top-phone
) {
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

/* The Gutter header is in normal flow; its mobile sidebar is fixed at top: 0.
 * A separate search row avoids squeezing the actual input beside three controls.
 */
@media (max-width: 700px) {
  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root .gt-topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    height: auto;
    padding: 8px 10px;
    gap: 8px;
    align-items: center;
  }

  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root #gt-menu-toggle {
    grid-column: 1;
    grid-row: 1;
  }

  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root .gt-breadcrumb {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root .gt-top-phone {
    grid-column: 3;
    grid-row: 1;
  }

  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root .gt-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 44px;
    box-sizing: border-box;
  }

  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root .gt-search input {
    min-width: 0;
    min-height: 44px;
  }
}

/* AI article tiles: keep nested mobile grids inside the article column.
 * At 360px the .mswt .grid container is 243px, but its implicit auto minimum
 * makes a 562px track (520px tools + tile padding/borders). Retain the existing
 * 710px/670px single-column breakpoints and allow grid items to shrink.
 */
html[data-msw-layout-main] .msw-prose .mswt .grid > .tile,
html[data-msw-layout-main] .msw-prose .mswt #msw-narzedzia-w-artykule > * {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 710px) {
  html[data-msw-layout-main] .msw-prose .mswt .grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 670px) {
  html[data-msw-layout-main] .msw-prose .mswt #msw-narzedzia-w-artykule {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep the compact desktop AI action at the same minimum target height. */
html[data-msw-layout-ready][data-msw-layout-main] .mswcp-root .mswcp-ai-launch {
  min-height: 44px !important;
}

/* The existing mobile sidebar fills the viewport and already scrolls.
 * Its .is-open state is handled by the shared overlay coordinator.
 * This template has no separate close button; Escape and the backdrop close it.
 */
@media (max-width: 980px) {
  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root #gt-sidebar {
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-block: 8px;
  }

  html[data-msw-layout-ready][data-msw-layout-main] #mswgutter-root #gt-sidebar :is(.gt-nav > a, .gt-side-support > a) {
    box-sizing: border-box;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }
}

/* Extend the homepage's existing compact orb layout to tablets only.
 * At 768px the desktop side links were clipped by about 20px on both edges.
 * Keep the <=760px phone rules and >=992px desktop layout unchanged.
 */
@media (min-width: 761px) and (max-width: 991px) {
  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero {
    height: auto;
    padding-bottom: 20px;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(245px, 1fr) 52px 40px;
    gap: 8px;
    height: 400px;
    width: 100%;
    min-width: 0;
    padding: 0 0 4px;
    align-items: center;
    overflow: visible;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] > canvas.msw-malta-canvas {
    top: 0;
    height: calc(100% - 108px);
    width: 100%;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] .orb-button {
    position: absolute;
    top: 0;
    left: 50%;
    width: 290px;
    height: calc(100% - 108px);
    transform: translateX(-50%) !important;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] .malta-main-fallback {
    top: calc(50% - 54px);
    width: 210px;
    height: 210px;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] > .sound-tag.msw-nkh-shell {
    grid-row: 2;
    align-self: stretch;
    z-index: 3;
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    transform: none !important;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] > .tag-left.msw-nkh-shell {
    grid-column: 1;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] > .tag-right.msw-nkh-shell {
    grid-column: 2;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] .sound-tag.msw-nkh-shell a.msw-nkh-button {
    height: 100%;
    min-height: 48px;
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 7px 9px !important;
    gap: 6px !important;
    transform: none !important;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] .msw-nkh-words :is(strong, small) {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .orb-stage[data-malta-orb] > .malta-orb-status {
    position: relative;
    inset: auto;
    grid-area: 3 / 1 / auto / -1;
    max-width: 100%;
    margin: 0;
    font-size: 11px;
  }
}

/* The desktop hero must grow with its disclosures and question buttons. */
@media (min-width: 992px) {
  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero {
    height: auto;
    min-height: 578px;
  }
}

/* Preserve the original large-screen minimum while allowing content growth. */
@media (min-width: 1920px) {
  html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero {
    min-height: 650px;
  }
}

html[data-msw-layout-ready][data-msw-layout-main] body.home #msw-premium .hero .question-chips > button {
  min-height: 44px;
}

/* Theme quick-contact/request row participates in the same measured stack.
 * Its own visibility breakpoint is preserved: only visible fixed bars are tagged.
 */
@media (max-width: 991px) {
  html[data-msw-layout-ready] :is(.msw-mobilebar, .mobile-contact)[data-msw-layout-bar] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 6px !important;
    padding: 6px !important;
    border: 1px solid rgba(112, 218, 242, .32) !important;
    border-radius: 14px !important;
    background: #0c2532 !important;
  }
  html[data-msw-layout-ready] :is(.msw-mobilebar, .mobile-contact)[data-msw-layout-bar] > :is(a, button) {
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    min-height: 44px !important;
    height: auto !important;
    flex: 1 1 0;
    margin: 0 !important;
    padding: 7px 6px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
}
