/* Cashback Pro V36.8.29 — Targeted chat sizing for one awkward desktop aspect ratio.
   Preserve the normal desktop chat size everywhere else. */
#ai-chat-modal.chat-modal {
  box-sizing: border-box !important;
  width: min(410px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  height: min(520px, calc(100dvh - var(--v36-header-height, 94px) - 100px)) !important;
  max-height: calc(100dvh - var(--v36-header-height, 94px) - 100px) !important;
  min-height: 210px !important;
  right: 16px !important;
  left: auto !important;
  bottom: calc(76px + env(safe-area-inset-bottom)) !important;
}

/* The user-reported compact desktop window is approximately 1.2:1.
   Adjust only that viewport band; do not shrink all desktop widths. */
@media (min-width: 601px) and (max-width: 1100px)
  and (min-height: 620px) and (max-height: 1000px)
  and (min-aspect-ratio: 1/1) and (max-aspect-ratio: 4/3) {
  #ai-chat-modal.chat-modal {
    width: min(340px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    height: min(430px, calc(100dvh - var(--v36-header-height, 94px) - 140px)) !important;
    max-height: calc(100dvh - var(--v36-header-height, 94px) - 140px) !important;
    right: 14px !important;
    left: auto !important;
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
}

/* Keep the existing full-width mobile chat behavior. */
@media (max-width: 600px) {
  #ai-chat-modal.chat-modal {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
    height: min(500px, calc(100dvh - 148px - env(safe-area-inset-top))) !important;
    max-height: calc(100dvh - 148px - env(safe-area-inset-top)) !important;
    bottom: calc(68px + env(safe-area-inset-bottom)) !important;
  }
}

/* Short landscape windows retain a usable message area and composer. */
@media (max-height: 560px) {
  #ai-chat-modal.chat-modal {
    height: max(180px, calc(100dvh - 142px - env(safe-area-inset-top))) !important;
    max-height: calc(100dvh - 142px - env(safe-area-inset-top)) !important;
    min-height: 180px !important;
    bottom: calc(62px + env(safe-area-inset-bottom)) !important;
  }
}
