/*! Fachowiec24 R25.11-A1 — TaskCreator viewport ownership */

/* CLS layers add `contain: layout` to main. That turns main into the containing
 * block for descendant fixed dialogs. Disable it only while TaskCreator exists. */
body.f24-task-creator-viewport-open {
  overflow: hidden !important;
}

body.f24-task-creator-viewport-open main {
  contain: none !important;
  transform: none !important;
  filter: none !important;
  perspective: none !important;
}

@supports selector(main:has(#client-dashboard-root div.fixed.inset-0)) {
  html body main:has(#client-dashboard-root div.fixed.inset-0 > div.max-w-2xl.w-full.overflow-y-auto) {
    contain: none !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
  }

  #client-dashboard-root div.fixed.inset-0:has(> div.max-w-2xl.w-full.overflow-y-auto) {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: none !important;
  }
}

[data-f24-task-creator-viewport="true"] {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  z-index: 2147483000 !important;
  overflow: hidden !important;
  overscroll-behavior: contain;
  isolation: isolate;
}

[data-f24-task-creator-viewport="true"] > :first-child {
  max-height: calc(100dvh - 2rem) !important;
  margin: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 639px) {
  [data-f24-task-creator-viewport="true"],
  #client-dashboard-root div.fixed.inset-0:has(> div.max-w-2xl.w-full.overflow-y-auto) {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: max(0.5rem, env(safe-area-inset-top)) 0 0 !important;
  }

  [data-f24-task-creator-viewport="true"] > :first-child,
  #client-dashboard-root div.fixed.inset-0:has(> div.max-w-2xl.w-full.overflow-y-auto) > :first-child {
    width: 100% !important;
    max-width: none !important;
    max-height: calc(100dvh - max(0.5rem, env(safe-area-inset-top))) !important;
    margin: auto 0 0 !important;
    border-bottom-right-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  [data-f24-task-creator-viewport="true"] > :first-child > :first-child {
    position: sticky;
    z-index: 20;
    top: 0;
    padding: 1rem !important;
    background: #fff;
  }
}
