.opw-ai-chat { box-sizing: border-box; width: 100%; max-width: 42rem; margin: 1.5rem auto; padding: 1rem; border: 1px solid #b8cec5; border-radius: .75rem; background: #fff; color: #17362b; font: 1rem/1.5 system-ui, sans-serif; }
.opw-ai-chat *, .opw-ai-chat *::before, .opw-ai-chat *::after { box-sizing: border-box; }
.opw-ai-chat h2 { margin: 0 0 .5rem; color: var(--opw-accent); font-size: 1.4rem; }
.opw-ai-chat__messages { height: 20rem; max-height: 50vh; overflow-y: auto; padding: .75rem; border: 1px solid #d4e1db; border-radius: .5rem; background: #f5f8f6; }
.opw-ai-chat__message { width: fit-content; max-width: 92%; padding: .65rem .85rem; margin: 0 0 .75rem; border-radius: .65rem; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
.opw-ai-chat__message--user { margin-left: auto; background: #dceee5; }
.opw-ai-chat__form { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.opw-ai-chat__form label { flex-basis: 100%; font-weight: 600; }
.opw-ai-chat input { flex: 1 1 12rem; min-width: 0; padding: .65rem; border: 1px solid #688c7c; border-radius: .3rem; font: inherit; color: #17362b; background: #fff; }
.opw-ai-chat button { min-height: 44px; padding: .6rem .9rem; border: 1px solid var(--opw-accent); border-radius: .3rem; background: var(--opw-accent); color: #fff; font: inherit; cursor: pointer; }
.opw-ai-chat .opw-ai-chat__clear { background: #fff; color: var(--opw-accent); }
.opw-ai-chat button:disabled { opacity: .6; cursor: default; }
.opw-ai-chat :focus-visible { outline: 3px solid #b45c09; outline-offset: 3px; }
.opw-ai-chat__status { min-height: 3em; font-size: .9rem; overflow-wrap: anywhere; }
@media (max-width: 480px) { .opw-ai-chat { padding: .75rem; } .opw-ai-chat input { flex-basis: 100%; } }

.opw-ai-chat-placement { position: fixed; left: 1rem; bottom: 6rem; z-index: 100; max-width: min(26rem, calc(100vw - 2rem)); }
.opw-ai-chat-placement summary { cursor: pointer; padding: .8rem; min-height: 44px; border-radius: .5rem; background: #145b46; color: white; font: 1rem/1.5 system-ui, sans-serif; }
.opw-ai-chat-placement .opw-ai-chat { margin: .5rem 0 0; max-height: 65dvh; overflow-y: auto; }
.opw-ai-chat-placement .opw-ai-chat__messages { height: 12rem; max-height: 25dvh; }

/* Opt-in replacement for the existing sitewide blue launcher. Other CTAs stay independent. */
.opw-ai-chat-placement--sitewide { left: auto; right: 8px; bottom: 28px; z-index: 100000; max-width: none; }
.opw-ai-chat-placement--sitewide summary { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 12px; background: #2563eb; color: #fff; box-shadow: 0 3px 12px #0003; font: 700 14px Arial, sans-serif; list-style: none; cursor: pointer; }
.opw-ai-chat-placement--sitewide summary::-webkit-details-marker { display: none; }
.opw-ai-chat-placement--sitewide summary:focus-visible { outline: 3px solid #fbbf24; outline-offset: 3px; }
.opw-ai-chat-placement--sitewide .opw-ai-chat { --opw-accent: #2563eb !important; position: absolute; right: 0; bottom: 68px; width: min(360px, calc(100vw - 32px)); max-height: min(520px, calc(100vh - 116px)); max-height: min(520px, calc(100dvh - 116px)); margin: 0; overflow-y: auto; color: #01133d; }
.opw-ai-chat-placement--sitewide .opw-ai-chat__messages { height: 12rem; max-height: 25dvh; }

/* Keep the mobile launcher above the existing bottom quote CTA. */
@media (max-width: 480px) {
  .opw-ai-chat-placement--sitewide { bottom: 96px; }
  .opw-ai-chat-placement--sitewide .opw-ai-chat { max-height: min(520px, calc(100vh - 184px)); max-height: min(520px, calc(100dvh - 184px)); }
}

/* An open mobile panel occupies the visible viewport, including keyboard changes.
   The closed launcher keeps its existing quote-CTA clearance. */
@media (max-width: 480px) {
  .opw-ai-chat-placement--sitewide details[open] .opw-ai-chat {
    position: fixed; top: calc(var(--opw-viewport-top, 0px) + 60px); bottom: auto;
    left: 8px; right: 8px; width: auto;
    height: calc(var(--opw-viewport-height, 100dvh) - 68px);
    max-height: calc(var(--opw-viewport-height, 100dvh) - 68px);
    display: flex; flex-direction: column; overflow: auto;
  }
  .opw-ai-chat-placement--sitewide details[open] .opw-ai-chat__messages {
    flex: 1 1 auto; min-height: 3rem; height: auto; max-height: none;
  }
  .opw-ai-chat-placement--sitewide details[open] .opw-ai-chat__form { flex: 0 0 auto; }
  .opw-ai-chat-placement--sitewide details[open] .opw-ai-chat__status { min-height: 0; margin: .25rem 0; }
  .opw-ai-chat-placement--sitewide details[open] summary {
    position: fixed; right: 8px;
    top: calc(var(--opw-viewport-top, 0px) + 8px);
  }
}

/* While open, the disclosure is a neutral close control, never a second Send. */
.opw-ai-chat-placement--sitewide details[open] summary {
  width: 108px; height: 44px; border: 1px solid #688c7c;
  border-radius: 6px; background: #fff; color: #01133d; box-shadow: 0 2px 6px #0002;
}

/* Responsive conversation panel: only messages scroll; composer stays in view. */
.opw-ai-chat-placement--sitewide .opw-ai-chat {
  height: min(640px, calc(100dvh - 120px));
  max-height: min(640px, calc(100dvh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
}
.opw-ai-chat-placement--sitewide .opw-ai-chat__messages {
  flex: 1 1 0; min-height: 0; height: auto; max-height: none;
}
.opw-ai-chat-placement--sitewide .opw-ai-chat__form {
  flex: 0 0 auto; flex-wrap: nowrap; align-items: stretch; gap: .375rem;
}
.opw-ai-chat-placement--sitewide .opw-ai-chat__form label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.opw-ai-chat-placement--sitewide .opw-ai-chat input { flex: 1 1 0; width: 0; min-width: 0; }
.opw-ai-chat-placement--sitewide .opw-ai-chat button { flex: 0 0 auto; padding: .5rem; }
.opw-ai-chat-placement--sitewide .opw-ai-chat__status {
  flex: 0 0 auto; min-height: 0; margin: .375rem 0 0; font-size: .8rem; line-height: 1.3;
}
.opw-ai-chat-placement--sitewide .opw-ai-chat h2 { flex: 0 0 auto; }
.opw-ai-chat-placement--sitewide[data-compact="true"] .opw-ai-chat > h2 + p { display: none; }
@media (max-height: 600px) {
  .opw-ai-chat-placement--sitewide .opw-ai-chat > h2 + p { display: none; }
}
@media (max-width: 480px) {
  .opw-ai-chat-placement--sitewide details[open] .opw-ai-chat {
    height: calc(var(--opw-viewport-height, 100dvh) - 76px);
    max-height: calc(var(--opw-viewport-height, 100dvh) - 76px);
    overflow: hidden;
  }
  .opw-ai-chat-placement--sitewide details[open] .opw-ai-chat__messages { min-height: 0; flex: 1 1 0; }
}
