/* Chatbot widget — file dedicato (non dipende da cache minify main.css) */
.spatti-chat {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-sans, system-ui, sans-serif);
  pointer-events: none;
}

.spatti-chat.is-open,
.spatti-chat .spatti-chat-fab {
  pointer-events: auto;
}

.spatti-chat-panel {
  display: none !important;
  flex-direction: column;
  width: min(400px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 6rem));
  margin-bottom: 0.75rem;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e3e7ee);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(10, 24, 48, 0.22);
  overflow: hidden;
}

.spatti-chat.is-open .spatti-chat-panel {
  display: flex !important;
}

.spatti-chat-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, #1E3F73, #2C5AA0);
  color: #fff;
  flex-shrink: 0;
}

.spatti-chat-brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.spatti-chat-logo {
  display: block;
  height: 26px;
  width: auto;
  max-width: min(210px, 70vw);
}

.spatti-chat-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.spatti-chat-title {
  display: none;
}

.spatti-chat-close {
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.spatti-chat-privacy {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.1rem 1.25rem;
  background: #f7f9fc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.spatti-chat-privacy-title {
  margin: 0;
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.05rem;
  color: var(--ink, #1a2332);
}

.spatti-chat-privacy-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted, #5a6578);
}

.spatti-chat-privacy-link {
  margin: 0;
  font-size: 0.88rem;
}

.spatti-chat-privacy-link a {
  color: var(--accent, #2C5AA0);
  font-weight: 600;
}

.spatti-chat-privacy-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.86rem;
  line-height: 1.45;
  cursor: pointer;
  color: var(--ink, #1a2332);
}

.spatti-chat-privacy-check input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.spatti-chat-privacy-accept {
  align-self: flex-start;
}

.spatti-chat.is-privacy-pending .spatti-chat-form,
.spatti-chat.is-privacy-pending .spatti-chat-messages {
  display: none !important;
}

.spatti-chat:not(.is-privacy-pending) .spatti-chat-privacy {
  display: none !important;
}

.spatti-chat-messages {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f7f9fc;
  min-height: 0;
}

.spatti-chat-msg {
  display: flex;
}

.spatti-chat-msg--user {
  justify-content: flex-end;
}

.spatti-chat-bubble {
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.spatti-chat-msg--assistant .spatti-chat-bubble {
  background: #fff;
  border: 1px solid var(--line, #e3e7ee);
  color: var(--ink, #1a2332);
}

.spatti-chat-msg--assistant .spatti-chat-link {
  color: var(--accent, #2C5AA0);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.spatti-chat-msg--assistant .spatti-chat-link:hover,
.spatti-chat-msg--assistant .spatti-chat-link:focus-visible {
  color: #1E3F73;
}

.spatti-chat-msg--user .spatti-chat-bubble {
  background: var(--accent, #2C5AA0);
  color: #fff;
}

.spatti-chat-msg--typing .spatti-chat-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 9.5rem;
}

.spatti-chat-typing-label {
  font-size: 0.86rem;
  color: var(--muted, #5a6578);
  font-style: italic;
}

.spatti-chat-typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}

.spatti-chat-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, #2C5AA0);
  opacity: 0.35;
  animation: spatti-chat-dot 1.2s ease-in-out infinite;
}

.spatti-chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.spatti-chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes spatti-chat-dot {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.spatti-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.35rem;
  border-top: 1px solid var(--line, #e3e7ee);
  background: #fff;
  flex-shrink: 0;
}

.spatti-chat-form textarea {
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line, #e3e7ee);
  border-radius: 12px;
  font: inherit;
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
}

.spatti-chat-send {
  justify-self: end;
}

.spatti-chat-note {
  margin: 0;
  padding: 0 0.85rem 0.75rem;
  font-size: 0.72rem;
  color: var(--muted, #5a6578);
  background: #fff;
  flex-shrink: 0;
}

.spatti-chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1E3F73, #2C5AA0);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: 0 12px 28px rgba(30, 63, 115, 0.35);
  cursor: pointer;
}

.spatti-chat-fab:hover {
  filter: brightness(1.05);
}

.spatti-chat.is-loading .spatti-chat-send {
  opacity: 0.6;
  pointer-events: none;
}

@media (max-width: 640px) {
  .spatti-chat {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .spatti-chat-fab-label {
    display: none;
  }

  .spatti-chat-panel {
    width: calc(100vw - 1.5rem);
  }
}
