/* Raviglie · widget chat (in basso a destra) */
.rv-chat { position: fixed; right: 20px; bottom: 20px; z-index: 70; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); }
.rv-launch { display: flex; align-items: center; justify-content: center; width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%; background: var(--accent-strong); color: #fff; cursor: pointer; box-shadow: 0 8px 24px rgba(10,118,196,.35), 0 2px 6px rgba(14,23,38,.15); transition: transform .15s, background .15s; }
.rv-launch:hover { background: var(--accent-hover); transform: scale(1.05); }
.rv-launch svg { width: 28px; height: 28px; }
.rv-launch .rv-x { display: none; }
.rv-chat.open .rv-launch .rv-ic { display: none; }
.rv-chat.open .rv-launch .rv-x { display: block; }
.rv-tip { position: absolute; right: 72px; bottom: 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .45rem .9rem; font-size: .85rem; font-weight: 600; white-space: nowrap; box-shadow: 0 6px 18px rgba(14,23,38,.1); }
.rv-chat.open .rv-tip, .rv-tip[hidden] { display: none; }

.rv-panel { position: absolute; right: 0; bottom: 76px; width: 370px; max-width: calc(100vw - 32px); height: 540px; max-height: calc(100vh - 120px); display: none; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(14,23,38,.22); overflow: hidden; }
.rv-chat.open .rv-panel { display: flex; animation: rvIn .18s ease-out; }
@keyframes rvIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.rv-head { display: flex; align-items: center; gap: .65rem; padding: .85rem 1rem; background: var(--accent-strong); color: #fff; }
.rv-head img { width: 30px; height: 30px; border-radius: 8px; background: #fff; padding: 3px; }
.rv-head b { display: block; font-size: 1rem; line-height: 1.2; }
.rv-head small { display: block; font-size: .78rem; opacity: .9; }
.rv-close { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; font-size: 22px; line-height: 1; }
.rv-close:hover { background: rgba(255,255,255,.18); }

.rv-log { flex: 1; overflow-y: auto; padding: 1rem; background: var(--tint); display: flex; flex-direction: column; gap: .6rem; overscroll-behavior: contain; }
.rv-m { max-width: 86%; padding: .6rem .85rem; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.rv-m.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.rv-m.me { align-self: flex-end; background: var(--accent-strong); color: #fff; border-bottom-right-radius: 4px; }
.rv-m a { color: var(--accent-strong); font-weight: 600; }
.rv-m.me a { color: #fff; }

.rv-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.rv-chip { font: inherit; font-size: .85rem; font-weight: 600; padding: .4rem .8rem; border-radius: 999px; border: 1.5px solid var(--accent); background: #fff; color: var(--accent-strong); cursor: pointer; }
.rv-chip:hover { background: var(--tint-2); }

.rv-typing { align-self: flex-start; display: flex; gap: 4px; padding: .75rem .9rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; border-bottom-left-radius: 4px; }
.rv-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: rvDot 1.1s infinite ease-in-out; }
.rv-typing span:nth-child(2) { animation-delay: .15s; }
.rv-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes rvDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.rv-form { display: flex; gap: .5rem; padding: .7rem .8rem; border-top: 1px solid var(--line); background: #fff; }
.rv-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: .65rem .9rem; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); }
.rv-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,163,242,.2); }
.rv-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--accent-strong); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rv-send:hover { background: var(--accent-hover); }
.rv-send:disabled { opacity: .5; cursor: default; }
.rv-send svg { width: 18px; height: 18px; }
.rv-note { margin: 0; padding: 0 .9rem .6rem; background: #fff; font-size: .74rem; line-height: 1.35; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .rv-chat { right: 14px; bottom: 14px; }
  .rv-chat.lift { bottom: 112px; }
  .rv-tip { display: none; }
  .rv-chat.open { right: 0; bottom: 0; left: 0; top: 0; }
  .rv-chat.open .rv-launch { display: none; }
  .rv-chat.open .rv-panel { position: fixed; inset: 0; width: auto; max-width: none; height: auto; max-height: none; border: 0; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .rv-chat.open .rv-panel, .rv-typing span { animation: none; } .rv-launch { transition: none; } }
