/* SÓCRATES NOVA V20.3.44 — Chat accessible on short viewports / browser zoom.
   Additive stylesheet: applies ONLY to the public chat; does not change Builder,
   Microsoft Graph, forms, menu or global typography. */

/* Keep the assistant above the sticky public header when opened. */
#chat-panel { z-index: 120; }

/* At 200% browser zoom, the CSS viewport is effectively much shorter.
   Use the full AVAILABLE viewport instead of positioning the chat 156px
   above the bottom and leaving its header hidden behind the sticky nav. */
@media (max-height: 650px) {
  #chat-panel:not([hidden]) {
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(380px, calc(100vw - 16px));
    height: auto;
    max-height: none;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #chat-panel .chat-header {
    flex: 0 0 auto;
    min-height: 0;
  }
  #chat-panel .chat-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  /* A long contact card must scroll inside messages, never be squeezed. */
  #chat-panel .chat-messages > .chat-bubble {
    flex-shrink: 0;
  }
  #chat-panel .chat-actions {
    flex: 0 0 auto;
    max-height: min(130px, 28dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #chat-panel .chat-form,
  #chat-panel .chat-disclaimer {
    flex: 0 0 auto;
  }
}
