.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(22, 51, 35, 0.12);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}

.fab-wa {
  text-decoration: none;
}

.chat {
  position: fixed;
  right: 86px;
  bottom: 18px;
  width: 360px;
  max-width: calc(100vw - 40px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(22, 51, 35, 0.12);
  background: rgba(237, 243, 237, 0.95);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  z-index: 999;
  max-height: calc(100vh - 24px);
}
.chat-header {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.65);
}
.chat-sub {
  font-size: 12px;
  opacity: 0.7;
  font-weight: 600;
}
.chat-x {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}

.chat-body {
  height: 320px;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 600;
  line-height: 1.4;
  font-size: 14px;
}
.msg.bot {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(22, 51, 35, 0.08);
  align-self: flex-start;
}
.msg.me {
  background: rgba(47, 138, 75, 0.15);
  border: 1px solid rgba(47, 138, 75, 0.22);
  align-self: flex-end;
}

/* Typing indicator animation */
.msg.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 18px;
}
.msg.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(47, 138, 75, 0.5);
  animation: typing-dot 1.4s infinite ease-in-out both;
}
.msg.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-footer {
  padding: 12px;
  border-top: 1px solid rgba(22, 51, 35, 0.1);
  background: rgba(255, 255, 255, 0.55);
}
.chat-whats {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(22, 51, 35, 0.12);
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 10px;
}
.chat-inputrow {
  display: flex;
  gap: 8px;
}
.chat-inputrow input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(22, 51, 35, 0.12);
}
.chat-inputrow button {
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  background: var(--green-500);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 520px) {
  .fab {
    right: 14px;
    bottom: 14px;
    gap: 10px;
    z-index: 1000;
  }
  .fab-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  /* estilo “sheet” móvil */
  .chat {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    border-radius: 18px 18px 0 0;
    z-index: 1001;
  }
  .chat-body {
    height: auto;
    max-height: calc(100vh - 220px);
  }
}
