/* Standalone chat interface. All component styles are scoped. */
.chat-launcher {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 12px 20px;
  border: 1px solid #d9d4e5;
  border-radius: 30px;
  background: #f3effa;
  color: #201c29;
  box-shadow: 0 8px 32px #0005;
  font: 700 .875rem/1.4 Manrope, Arial, sans-serif;
  cursor: pointer;
}
.chat-launcher[hidden] { display: none; }
.chat-launcher:hover { background: #ded5f0; }
.chat-launcher svg, .chat-close svg { flex-shrink: 0; }
.chat-panel {
  position: fixed;
  inset: auto max(24px, env(safe-area-inset-right)) calc(90px + env(safe-area-inset-bottom)) auto;
  z-index: 31;
  margin: 0;
  padding: 0;
  width: 390px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 112px);
  max-height: calc(100dvh - 112px - env(safe-area-inset-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #49424f;
  border-radius: 22px;
  background: #17151c;
  color: #f4f1f7;
  box-shadow: 0 20px 70px #0008;
  font: 400 .875rem/1.6 Manrope, Arial, sans-serif;
}
.chat-panel:not([open]) { display: none; }
.chat-frame { display: block; width: 100%; flex: 1; min-height: 0; border: 0; background: #fcfbfe; }
.chat-frame[hidden] { display: none; }
.chat-panel.chat-connected[open] { display: flex; flex-direction: column; height: 640px; overflow: hidden; }
.chat-connected .chat-header { flex-shrink: 0; }
.chat-connected .chat-body, .chat-connected .chat-composer { display: none; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 20px 16px 20px 20px; border-bottom: 1px solid #39333f; }
.chat-avatar { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border: 1px solid #80718f; border-radius: 13px; color: #e5d8f7; font-size: .8rem; font-weight: 800; }
.chat-heading { flex: 1; min-width: 0; }
.chat-heading h2 { margin: 0; font-size: .94rem; line-height: 1.4; letter-spacing: -.02em; }
.chat-heading p { margin: 4px 0 0; color: #bdb5c7; font-size: .75rem; }
.chat-close { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #eee7f4; cursor: pointer; }
.chat-close:hover { background: #332c3c; }
.chat-body { padding: 22px 20px; }
.chat-intro { margin: 0 0 12px; color: #bdb5c7; font-size: .75rem; }
.chat-welcome { margin: 0; padding: 15px; border: 1px solid #403746; border-radius: 4px 16px 16px; background: #27212e; }
.chat-notice { margin-top: 22px; font-size: .8rem; color: #c9c1d2; }
.chat-notice strong { color: #f1eaf8; }
.chat-notice p { margin: 5px 0 8px; }
.chat-notice a { display: inline-flex; align-items: center; min-height: 44px; gap: 12px; color: #ddc7ff; text-underline-offset: 4px; }
.chat-composer { padding: 16px 20px 20px; border-top: 1px solid #39333f; }
.chat-composer label { display: block; margin-bottom: 8px; font-weight: 600; font-size: .8rem; }
.chat-composer textarea { display: block; width: 100%; min-height: 86px; max-height: 160px; resize: vertical; border: 1px solid #65566f; border-radius: 12px; padding: 12px; background: #211b28; color: #fff; font: inherit; font-size: 16px; }
.chat-composer textarea::placeholder { color: #b7aebf; }
.chat-composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.chat-composer-bottom small { max-width: 180px; color: #bdb5c7; font-size: .7rem; }
.chat-send { min-height: 44px; padding: 10px 14px; border: 1px solid #54495e; border-radius: 24px; background: #342b3e; color: #bcb1c7; font: 600 .8rem Manrope, Arial, sans-serif; white-space: nowrap; cursor: not-allowed; }
.chat-launcher:focus-visible, .chat-panel :focus-visible { outline: 3px solid #c4b4ed; outline-offset: 3px; }
@media (max-width: 560px) {
  .chat-launcher { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); min-height: 48px; padding: 11px 15px; font-size: .8rem; }
  .chat-panel { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 92px - env(safe-area-inset-bottom)); }
  .chat-header { padding: 16px 12px; gap: 8px; }
  .chat-body, .chat-composer { padding: 16px; }
  .chat-heading h2 { font-size: .85rem; }
}
