/* Sublimaticamente — assistente virtuale (usa le variabili di style.css) */
/* ---------- Assistente virtuale ---------- */
.chatw { position: fixed; right: 20px; bottom: 20px; z-index: 60; font-family: var(--font); }
.chatw-launch { display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer; background: var(--ink); color: #fff; height: 54px; padding: 0 20px 0 8px; border-radius: 999px; box-shadow: 0 8px 28px rgba(12, 14, 19, .28); font: 600 .92rem var(--font); transition: transform .15s, box-shadow .15s; }
.chatw-launch:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(12, 14, 19, .34); }
.chatw-launch-ico { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; }
.chatw-launch-ico .ico { width: 20px; height: 20px; }
.chatw.open .chatw-launch { display: none; }
@media (max-width: 560px) { .chatw { right: 14px; bottom: 14px; } .chatw-launch-txt { display: none; } .chatw-launch { padding: 0 7px; } }

.chatw-panel { position: fixed; right: 20px; bottom: 20px; width: 390px; height: min(620px, calc(100vh - 40px)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-3); display: flex; flex-direction: column; overflow: hidden; animation: chatwIn .18s ease-out; }
.chatw-panel[hidden] { display: none; }
@keyframes chatwIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 560px) { .chatw-panel { inset: 0; width: auto; height: 100%; border-radius: 0; border: 0; } }

.chatw-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; background: var(--dark); color: #fff; border-bottom: 3px solid; border-image: linear-gradient(90deg, var(--cyan) 0 33.3%, var(--magenta) 33.3% 66.6%, var(--yellow) 66.6%) 1; }
.chatw-avatar { position: relative; flex: none; }
.chatw-avatar .brand-mark { width: 36px; height: 36px; display: block; }
.chatw-avatar i { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid var(--dark); }
.chatw-title { flex: 1; min-width: 0; line-height: 1.25; }
.chatw-title strong { display: block; font: 700 .95rem var(--display); letter-spacing: -.01em; }
.chatw-title span { font-size: .75rem; color: #9ba1ad; }
.chatw-hbtn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: #aeb3bf; cursor: pointer; display: grid; place-items: center; }
.chatw-hbtn:hover { background: rgba(255,255,255,.08); color: #fff; }

.chatw-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.chatw-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.5; word-wrap: break-word; }
.chatw-msg p { margin: 0 0 .45em; } .chatw-msg p:last-child { margin: 0; }
.chatw-msg ul { margin: .3em 0 .45em; padding-left: 1.15em; } .chatw-msg li { margin: .15em 0; }
.chatw-msg a { color: var(--brand); font-weight: 600; }
.chatw-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink); }
.chatw-msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.chatw-typing { display: inline-flex; gap: 4px; padding: 14px 14px; }
.chatw-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); animation: chatwDot 1.2s infinite ease-in-out; }
.chatw-typing span:nth-child(2) { animation-delay: .15s; } .chatw-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatwDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chatw-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chatw-sugg button { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 7px 12px; font: 500 .8rem var(--font); cursor: pointer; text-align: left; }
.chatw-sugg button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chatw-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chatw-wa { background: #16a34a; color: #fff; --b: #16a34a; }
.chatw-wa:hover { background: #15803d; --b: #15803d; }

.chatw-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chatw-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: 10px 12px; border-radius: 12px; font-size: .92rem; line-height: 1.4; }
.chatw-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; background: var(--brand); color: #fff; cursor: pointer; display: grid; place-items: center; }
.chatw-send:hover { background: var(--brand-hover); }
.chatw-foot { padding: 0 14px 10px; background: var(--surface); font-size: .7rem; color: var(--ink-4); text-align: center; }

/* Admin chat */
.chat-admin { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
@media (max-width: 880px) { .chat-admin { grid-template-columns: 1fr; } }
.chat-list { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow: auto; }
.chat-row { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.chat-row:hover { background: #fafaf8; }
.chat-row.on { background: var(--brand-soft); }
.chat-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; }
.chat-row-top .status-pill { padding: 2px 8px; font-size: .7rem; }
.chat-row-prev { font-size: .88rem; color: var(--ink-2); margin: 4px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transcript { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border-radius: 12px; padding: 14px; max-height: 65vh; overflow: auto; }

.chatw .ico { width: 18px; height: 18px; flex: none; }
.chatw .ico-sm { width: 15px; height: 15px; }
