.chat-launcher { position: fixed; left: 20px; bottom: 18px; z-index: 70; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 12px 16px; border: 1px solid white; border-radius: 5px; color: white; background: #005dcc; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 18px #0002; }
.chat-launcher svg { width: 19px; height: 19px; flex-shrink: 0; }
.chat-launcher:focus-visible, .polyiso-chat button:focus-visible, .polyiso-chat a:focus-visible { outline: 3px solid #6cafff; outline-offset: 3px; }
.polyiso-chat { position: fixed; left: 20px; bottom: 76px; z-index: 90; width: 420px; max-width: calc(100vw - 40px); height: min(740px, calc(100dvh - 100px)); display: flex; flex-direction: column; background: white; border: 1px solid #bdd8ff; border-radius: 8px; box-shadow: 0 10px 50px #0003; color: #111; overflow: hidden; font-family: 'DM Sans', sans-serif; }
.polyiso-chat[hidden], .polyiso-chat [hidden] { display: none; }
.polyiso-chat button, .polyiso-chat textarea { font: inherit; }
.chat-heading { display: flex; align-items: center; gap: 10px; padding: 15px 18px; background: #005dcc; color: white; flex-shrink: 0; }
.chat-heading img { object-fit: contain; background: white; border-radius: 3px; padding: 3px; }
.chat-heading h2 { font-size: 16px; line-height: 1.4; margin: 0; }
.chat-heading span { font-size: 11px; }
.chat-heading .chat-close { margin-left: auto; width: 40px; height: 40px; border: 0; background: transparent; color: white; font-size: 27px; cursor: pointer; }
.chat-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: #edf5ff; font-size: 11px; flex-shrink: 0; }
.chat-toolbar button { padding: 7px 4px; color: #005dcc; border: 0; background: transparent; cursor: pointer; text-decoration: underline; }
.chat-messages { padding: 16px; overflow: auto; flex: 1; min-height: 90px; overscroll-behavior: contain; scroll-behavior: smooth; }
.chat-bubble { margin-bottom: 14px; padding: 12px 14px; border-radius: 6px; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.chat-bubble.assistant { background: #edf5ff; border: 1px solid #bdd8ff; margin-right: 10px; }
.chat-bubble.user { background: #005dcc; color: white; margin-left: 24px; white-space: pre-wrap; }
.chat-bubble p { font-size: inherit; line-height: inherit; margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble a { color: #005dcc; text-decoration: underline; }
.chat-bubble ul { padding-left: 19px; }
.chat-bubble li { margin: 4px 0; }
.chat-estimate { background: white; border: 1px solid #005dcc; padding: 12px; font-size: 12px; line-height: 1.55; margin-bottom: 14px; border-radius: 4px; }
.chat-estimate summary { font-weight: 700; color: #005dcc; cursor: pointer; }
.chat-estimate pre { font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 0; }
.chat-estimate-output { font-weight: 700; font-size: 15px; margin: 6px 0; color: #005dcc; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 10px; flex-shrink: 0; }
.chat-suggestions button { padding: 8px 10px; color: #005dcc; border: 1px solid #bdd8ff; border-radius: 3px; background: white; font-size: 11px; cursor: pointer; }
.chat-suggestions button:disabled { opacity: .5; }
.polyiso-chat .chat-status { font-size: 11px; line-height: 1.4; color: #234b7a; margin: 0; padding: 0 16px 8px; flex-shrink: 0; min-height: 22px; }
.chat-form { border-top: 1px solid #bdd8ff; padding: 10px 14px; flex-shrink: 0; }
.chat-form label { display: block; font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.chat-input-row { display: flex; align-items: stretch; gap: 7px; }
.chat-form textarea { min-width: 0; width: 100%; resize: none; border: 1px solid #bdd8ff; border-radius: 3px; padding: 9px; font-size: 14px; margin: 0; min-height: 52px; }
.chat-send, .chat-stop { border: 0; background: #005dcc; color: white; border-radius: 3px; padding: 10px; font-size: 12px; cursor: pointer; }
.chat-form .chat-privacy { margin: 8px 0 0; font-size: 10px; line-height: 1.45; color: #234b7a; }
.chat-privacy a { text-decoration: underline; }
.chat-human { display: flex; flex-wrap: wrap; gap: 6px 14px; border-top: 1px solid #bdd8ff; padding: 10px 14px; font-size: 11px; flex-shrink: 0; }
.chat-human span { width: 100%; }
.chat-human a { color: #005dcc; font-weight: 700; text-decoration: underline; }
@media (max-width:600px) {
 .chat-launcher { left: 12px; bottom: 12px; padding: 10px; gap: 6px; max-width: calc(100vw - 200px); font-size: 10px; }
 .chat-launcher svg { width: 17px; height: 17px; }
 .polyiso-chat { left: 8px; bottom: 68px; width: calc(100vw - 16px); max-width: none; height: calc(100dvh - 88px); }
 .chat-heading { padding: 10px 12px; }
 .chat-messages { padding: 12px; }
 .chat-suggestions { padding: 0 12px 8px; }
 .chat-form textarea { font-size: 16px; }
}
@media (max-height:560px) { .chat-suggestions, .chat-toolbar { display: none; } .polyiso-chat { bottom: 60px; height: calc(100dvh - 72px); } }
@media (prefers-reduced-motion: reduce) { .chat-messages { scroll-behavior: auto; } }

/* Lanciatore compatto, stessa misura di WhatsApp e sola icona. */
.chat-launcher { width: 44px; height: 44px; min-height: 44px; max-width: 44px; border: 0; border-radius: 50%; padding: 10px; gap: 0; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); }
.chat-launcher svg { width: 24px; height: 24px; }
.chat-heading > div { min-width: 0; }
.chat-heading h2 { overflow-wrap: anywhere; }
.chat-close { flex-shrink: 0; }
@media (max-width:600px) {
 .chat-launcher { width: 44px; height: 44px; max-width: 44px; padding: 10px; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); }
 .chat-launcher svg { width: 24px; height: 24px; }
 .polyiso-chat { bottom: max(68px, calc(env(safe-area-inset-bottom) + 56px)); }
 .chat-heading h2 { font-size: 15px; }
}
