.pw-chat {
  --pw-ink: #14213d;
  --pw-paper: #fffdf8;
  --pw-copper: #8e5228;
  --pw-line: #e2dacb;
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 1000;
  font: 400 16px/1.5 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #3a4256;
  text-align: left;
  letter-spacing: normal;
}
.pw-chat *, .pw-chat *::before, .pw-chat *::after { box-sizing: border-box; }
.pw-chat [hidden] { display: none !important; }
.pw-chat button, .pw-chat textarea, .pw-chat a { font-family: inherit; }
.pw-chat button { cursor: pointer; font-size: 14px; line-height: 1.4; letter-spacing: normal; text-transform: none; }
.pw-chat button:disabled { cursor: default; opacity: .6; }
.pw-chat :is(button, textarea, a, [tabindex]):focus-visible { outline: 3px solid var(--pw-copper); outline-offset: 3px; }
.pw-chat p, .pw-chat h2 { margin: 0; }
.pw-chat a { color: var(--pw-copper); text-decoration: underline; text-underline-offset: 3px; }
.pw-chat-launcher { display: block; margin-left: auto; min-height: 52px; border: 1px solid #35425c; border-radius: 999px; padding: 14px 22px; background: var(--pw-ink); color: var(--pw-paper); box-shadow: 0 6px 24px #14213d30; font-weight: 600; }
.pw-chat-launcher::before { content: '✦'; margin-right: 10px; color: #e7ba95; }
.pw-chat-panel { display: flex; flex-direction: column; width: 410px; max-width: calc(100vw - 40px); height: 690px; max-height: calc(100dvh - 112px); margin: 0 0 12px; padding: 0; border: 1px solid var(--pw-line); border-radius: 20px; background: var(--pw-paper); box-shadow: 0 16px 64px #14213d35; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.pw-chat-header { display: flex; align-items: flex-start; gap: 10px; padding: 20px 18px 16px; background: var(--pw-ink); color: var(--pw-paper); text-align: left; flex-shrink: 0; }
.pw-chat-eyebrow { color: #e7ba95; font-size: 14px; font-weight: 600; letter-spacing: .035em; margin-bottom: 6px !important; }
.pw-chat h2 { padding: 0; border: 0; font: 500 25px/1.15 'Fraunces', Georgia, serif; color: var(--pw-paper); }
.pw-chat-close { flex-shrink: 0; margin-left: auto; width: 44px; height: 44px; border: 1px solid #647087; border-radius: 50%; color: var(--pw-paper); background: transparent; font-size: 28px !important; }
.pw-chat-notice { padding: 12px 18px; background: #f6f2ea; font-size: 14px; line-height: 1.45; border-bottom: 1px solid var(--pw-line); flex-shrink: 0; }
.pw-chat-status { padding: 9px 18px; color: #5f6676; font-size: 14px; line-height: 1.4; flex-shrink: 0; }
.pw-chat-log { flex: 1 1 auto; min-height: 85px; overflow-y: auto; overscroll-behavior: contain; padding: 8px 18px 16px; scrollbar-gutter: stable; }
.pw-chat-welcome { color: #3a4256; padding: 6px 0 12px; }
.pw-chat-message { width: fit-content; max-width: 94%; margin-top: 12px; padding: 12px 14px; border-radius: 14px 14px 14px 3px; background: #f1ece2; overflow-wrap: anywhere; }
.pw-chat-message-user { margin-left: auto; border-radius: 14px 14px 3px 14px; color: var(--pw-paper); background: var(--pw-ink); }
.pw-chat-speaker { font-size: 14px; font-weight: 600; margin-bottom: 5px !important; }
.pw-chat-content { white-space: pre-wrap; }
.pw-chat-delivery { font-size: 14px; margin-top: 8px !important; color: #f4cdad; }
.pw-chat-starters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 10px; flex-shrink: 0; }
.pw-chat-starter, .pw-chat-retry { min-height: 44px; padding: 8px 10px; border: 1px solid #c9bfac; border-radius: 10px; background: var(--pw-paper); color: var(--pw-copper); }
.pw-chat-form { padding: 12px 18px; border-top: 1px solid var(--pw-line); flex-shrink: 0; }
.pw-chat-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--pw-ink); }
.pw-chat-input { display: block; width: 100%; min-height: 64px; max-height: 130px; resize: vertical; border: 1px solid #a69b88; border-radius: 10px; padding: 10px; background: #fff; color: var(--pw-ink); font-size: 16px; line-height: 1.4; }
.pw-chat-input::placeholder { color: #666b76; opacity: 1; }
.pw-chat-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.pw-chat-counter { color: #5f6676; font-size: 14px; }
.pw-chat-send { min-height: 44px; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--pw-ink); color: var(--pw-paper); font-weight: 600; }
.pw-chat-error { color: #8a301e; font-size: 14px; margin-top: 10px !important; }
.pw-chat-retry { margin-top: 8px; }
.pw-chat-footer { padding: 10px 18px 14px; border-top: 1px solid var(--pw-line); font-size: 14px; background: #f6f2ea; color: inherit; text-align: left; flex-shrink: 0; }
.pw-chat-handoff { display: inline-block; padding: 5px 0; font-weight: 600; }
.pw-chat-sources { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; }
@media (hover: hover) {
  .pw-chat button:not(:disabled):hover { filter: brightness(1.12); }
}
@media (max-width: 480px) {
  .pw-chat { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); max-width: calc(100% - 24px); }
  .pw-chat-panel { width: 366px; max-width: 100%; max-height: calc(100dvh - 88px); }
  .pw-chat-header { padding: 15px 14px 12px; }
  .pw-chat h2 { font-size: 23px; }
  .pw-chat-notice, .pw-chat-status, .pw-chat-form, .pw-chat-footer { padding-left: 14px; padding-right: 14px; }
}
@media (max-height: 720px) {
  .pw-chat-panel { overflow-y: auto; overscroll-behavior: contain; }
  .pw-chat-header { padding-top: 12px; padding-bottom: 12px; }
  .pw-chat-starters { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .pw-chat-launcher { transition: background-color .2s ease-out, box-shadow .2s ease-out; }
}
