/*
 * FTHYRK responsive v80
 * Layout-only safeguards layered on top of the immutable v78 image.
 * Every rule requires a marker emitted by fthyrk-responsive-v80.js.
 */

html[data-fthyrk-responsive='v80'],
html[data-fthyrk-responsive='v80'] body,
html[data-fthyrk-responsive='v80'] #root {
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-shell-layout],
html[data-fthyrk-responsive='v80'] [data-fthyrk-shell-main],
html[data-fthyrk-responsive='v80'] [data-fthyrk-shell-main-child] {
  min-inline-size: 0 !important;
  max-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-shell-sidebar] {
  min-block-size: 0;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-shell-sidebar-nav] {
  min-block-size: 0;
  overflow-y: auto !important;
  overscroll-behavior-block: contain;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-shell],
html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-sidebar],
html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-main] {
  min-inline-size: 0;
  max-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-page],
html[data-fthyrk-responsive='v80'] [data-fthyrk-page-content],
html[data-fthyrk-responsive='v80'] [data-fthyrk-page-primary] {
  min-inline-size: 0;
  min-block-size: 0;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-page-sidebar] {
  min-inline-size: 0;
  max-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-email-editor-viewport] {
  block-size: 100% !important;
  max-block-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-table] {
  min-inline-size: 0 !important;
  max-inline-size: 100% !important;
  overflow-x: auto !important;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-table] table {
  min-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-dialog] {
  max-width: calc(100vw - 1rem) !important;
  max-height: calc(100vh - 1rem) !important;
  max-height: calc(100dvh - 1rem) !important;
  max-inline-size: calc(100vw - 1rem) !important;
  max-block-size: calc(100vh - 1rem) !important;
  max-block-size: calc(100dvh - 1rem) !important;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-dialog-scroll] {
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-popper] {
  min-inline-size: 0 !important;
  max-inline-size: calc(100vw - .5rem) !important;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-popper] > * {
  max-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-grid] > * {
  min-inline-size: 0;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-webhook-url-row],
html[data-fthyrk-responsive='v80'] [data-fthyrk-webhook-url-input] {
  min-inline-size: 0 !important;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-webhook-url-input] {
  flex: 1 1 0% !important;
  inline-size: auto !important;
  max-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-webhook-url-row] > button {
  flex: none;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-node-panel] {
  inline-size: min(26.25rem, calc(100vw - 2rem)) !important;
  max-inline-size: 100%;
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-floating-panel] {
  max-inline-size: calc(100vw - 1rem);
  max-block-size: calc(100vh - 1rem);
  max-block-size: calc(100dvh - 1rem);
}

html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-report-actions] {
  max-inline-size: calc(100vw - 1rem);
  max-block-size: calc(100vh - 1rem);
  max-block-size: calc(100dvh - 1rem);
}

html[data-fthyrk-public-scroll='v80'] #root {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

html[data-fthyrk-public-scroll='v80'] [data-fthyrk-public-page] {
  block-size: auto !important;
  min-block-size: 100vh;
  min-block-size: 100dvh;
  min-inline-size: 0;
}

/* Campaign wizard: the application main element remains the only scroll owner. */
html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-shell],
html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-root] {
  block-size: auto !important;
  min-block-size: 100% !important;
}

html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-step-host] {
  flex: none !important;
  min-block-size: 0 !important;
  overflow: visible !important;
}

html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-step-root] {
  block-size: auto !important;
  min-block-size: 0 !important;
  min-inline-size: 0 !important;
}

html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-scroll] {
  flex: none !important;
  block-size: auto !important;
  min-block-size: 0 !important;
  max-block-size: none !important;
  overflow: visible !important;
}

html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-footer] button {
  min-block-size: 2.75rem;
}

@media (max-width: 719px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-dialog='macro-form'] {
    inline-size: calc(100vw - 1rem) !important;
    min-inline-size: 0 !important;
  }
}

@media (max-width: 900px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-header-mobile] {
    display: flex !important;
    min-inline-size: 0;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-header-desktop],
  html[data-fthyrk-responsive='v80'] [data-fthyrk-shell-sidebar] {
    display: none !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-mobile-nav-sheet] {
    width: min(20rem, calc(100vw - .5rem)) !important;
    max-width: calc(100vw - .5rem) !important;
    inline-size: min(20rem, calc(100vw - .5rem)) !important;
    max-inline-size: calc(100vw - .5rem) !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-shell] {
    flex-direction: column !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-sidebar] {
    inline-size: 100% !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-sidebar].hidden,
  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-main].hidden {
    display: none !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-sidebar].flex,
  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-main].flex {
    display: flex !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-separator] {
    display: none !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-back],
  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-main] > div:first-child button[class~='md:hidden'] {
    display: inline-flex !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-dialog='agent-wizard'] {
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    height: min(94vh, calc(100vh - 1rem)) !important;
    height: min(94dvh, calc(100dvh - 1rem)) !important;
    max-height: calc(100dvh - 1rem) !important;
    inline-size: calc(100vw - 2rem) !important;
    max-inline-size: calc(100vw - 2rem) !important;
    block-size: min(94vh, calc(100vh - 1rem)) !important;
    block-size: min(94dvh, calc(100dvh - 1rem)) !important;
    max-block-size: calc(100dvh - 1rem) !important;
  }
}

@media (min-width: 901px) and (max-width: 1199px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-chat-sidebar] {
    inline-size: clamp(16rem, 32vw, 22rem) !important;
  }
}

@media (max-width: 1023px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-segment-builder] {
    flex-direction: column !important;
    block-size: auto !important;
    overflow: visible !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-segment-canvas] {
    flex: none !important;
    inline-size: 100%;
    block-size: clamp(20rem, 55dvh, 34rem);
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-segment-inspector] {
    inline-size: 100% !important;
    flex: none !important;
    max-block-size: none;
    overflow-y: visible;
    border-inline-start-width: 0;
    border-block-start-width: 1px;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-page='documentation'] [data-fthyrk-page-content],
  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-page='agent-edit'] {
    flex-direction: column !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-page-sidebar='documentation'] {
    inline-size: 100% !important;
    max-block-size: min(16rem, 35vh);
    max-block-size: min(16rem, 35dvh);
    overflow-y: auto;
    border-inline-end-width: 0;
    border-block-end-width: 1px;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-page-sidebar='agent-edit'] {
    inline-size: 100% !important;
    max-block-size: min(17rem, 38vh);
    max-block-size: min(17rem, 38dvh);
    overflow-y: auto;
    border-inline-end-width: 0;
    border-block-end-width: 1px;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-page='email-template-editor'] [data-fthyrk-page-content] {
    flex-direction: column !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-page-sidebar='email-template-editor'] {
    inline-size: 100% !important;
    flex: none !important;
    overflow-y: visible !important;
    padding-inline-end: 0 !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-page-primary='email-template-editor'] {
    flex: none !important;
    block-size: max(28rem, calc(100vh - 8rem));
    block-size: max(28rem, calc(100dvh - 8rem));
  }
}

@media (max-width: 900px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-page='admin-settings'] {
    flex-direction: column !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-page-sidebar='admin-settings'] {
    inline-size: 100% !important;
    max-block-size: min(14rem, 36vh);
    max-block-size: min(14rem, 36dvh);
    overflow-y: auto;
    border-inline-end-width: 0;
    border-block-end-width: 1px;
  }
}

@media (max-width: 640px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-dialog] {
    width: calc(100vw - 1rem) !important;
    min-width: 0 !important;
    inline-size: calc(100vw - 1rem) !important;
    min-inline-size: 0 !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-grid] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-grid] > * {
    grid-column: 1 / -1 !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-filter-row] {
    flex-direction: column !important;
    align-items: stretch !important;
    overflow: visible !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-filter-row] > div {
    flex: none !important;
    inline-size: 100%;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-filter-row] > button {
    align-self: flex-end;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-dialog='agent-test-chat'] {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    height: calc(100dvh - 1rem) !important;
    max-height: calc(100dvh - 1rem) !important;
    inline-size: calc(100vw - 1rem) !important;
    max-inline-size: calc(100vw - 1rem) !important;
    block-size: calc(100dvh - 1rem) !important;
    max-block-size: calc(100dvh - 1rem) !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-agent-test-shell] {
    flex-direction: column !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-agent-test-sessions] {
    inline-size: 100% !important;
    max-block-size: min(14rem, 35dvh);
    flex: none !important;
    border-inline-end-width: 0;
    border-block-end-width: 1px;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-agent-test-main] {
    min-block-size: 0;
    min-inline-size: 0;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-node-panel-host] {
    inset-inline: .5rem !important;
    margin-inline: 0 !important;
    max-inline-size: none !important;
    max-block-size: calc(100% - 4rem);
    overflow-y: auto;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-node-panel] {
    inline-size: 100% !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-segment-canvas] {
    block-size: 20rem;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-profile-tabs] {
    block-size: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }


  html[data-fthyrk-responsive='v80'] [data-fthyrk-page-header='email-template-editor'] {
    flex-wrap: wrap;
    gap: .75rem;
  }
}

@media (max-width: 767px), (max-height: 700px) {
  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-header] {
    padding: .85rem 1rem !important;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-progress] {
    padding: .75rem 1rem !important;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-progress-card] {
    margin-block-end: .75rem !important;
    padding: 1rem !important;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-step-root] {
    padding: 1rem !important;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-footer] {
    margin-block-start: 1rem !important;
    padding-block-start: 1rem !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-edit-item-body] {
    block-size: min(29.375rem, calc(100vh - 13rem)) !important;
    block-size: min(29.375rem, calc(100dvh - 13rem)) !important;
    min-block-size: 7rem;
  }
}

@media (max-width: 480px), (max-height: 650px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-floating-panel='support'] {
    inset-block-end: .5rem !important;
    block-size: min(32.5rem, calc(100vh - 1rem)) !important;
    block-size: min(32.5rem, calc(100dvh - 1rem)) !important;
  }
}

@media (max-width: 480px) {
  html[data-fthyrk-responsive='v80'] [data-fthyrk-header-mobile] {
    padding-inline: .5rem !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-header-mobile] > div {
    min-inline-size: 0;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-header-mobile] > div:first-child {
    flex: 0 0 2.5rem;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-header-mobile] > div:nth-child(2) {
    flex: 1 1 auto;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-header-mobile] > div:last-child {
    flex: 0 0 auto;
    gap: .25rem;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-dialog='agent-wizard'] {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    inline-size: calc(100vw - 1rem) !important;
    max-inline-size: calc(100vw - 1rem) !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-floating-panel='support'] {
    inset-inline: .5rem !important;
    inline-size: auto !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-report-dialog] [data-slot='dialog-footer'] {
    margin-block-start: var(--fthyrk-responsive-report-actions-space, 12rem) !important;
  }

  html[data-fthyrk-responsive='v80'] [data-fthyrk-responsive-report-actions] {
    overflow-y: auto;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-progress-label] {
    display: none !important;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-progress-card] {
    margin-block-end: .35rem !important;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-footer] {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: .65rem !important;
  }

  html[data-fthyrk-campaign-wizard='v80'] [data-fthyrk-wizard-footer] button {
    inline-size: 100% !important;
  }
}
