#chat-widget {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1080;
  font-family: inherit;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 12px;
}

#chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5eead4, #60a5fa);
  color: #07111f;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 28px rgba(96, 165, 250, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#chat-toggle:focus {
  outline: 3px solid rgba(94, 234, 212, 0.22);
}

#chat-toggle i {
  font-size: 1.25rem;
}

#chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 320px;
  max-width: calc(100vw - 40px);
  background: rgba(15, 23, 42, 0.96);
  color: #e5eefb;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 20px 54px rgba(2, 8, 23, 0.34);
  transform-origin: bottom right;
  transition: transform 180ms ease, opacity 180ms ease;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
}

#chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.chat-panel-body {
  padding: 12px 14px 16px;
}

.chat-panel p.small {
  margin-bottom: 8px;
  color: #94a3b8;
}

#chat-panel .btn {
  border-radius: 999px;
}

@media (max-width: 420px) {
  #chat-panel {
    width: calc(100% - 32px);
    border-radius: 16px;
    right: 8px;
    left: 8px;
    bottom: 80px;
  }
}

@media (max-width: 576px) {
  #chat-widget {
    right: 12px;
    bottom: 12px;
    gap: 10px;
  }

  #chat-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 76px;
    width: auto;
    border-radius: 16px;
    max-height: calc(100vh - 140px);
    overflow: auto;
  }

  .chat-panel.open {
    transform: translateY(0) scale(1);
  }

  .chat-panel-body .d-grid,
  .chat-panel-body .d-flex {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
  }

  .chat-panel-body .btn {
    width: 100%;
  }

  .chat-panel-header {
    padding: 10px 12px;
  }

  .chat-panel-header strong {
    display: block;
    white-space: normal;
    font-size: 1rem;
  }

  .chat-panel-body p.small {
    white-space: normal;
  }
}

#chat-whatsapp .bi-whatsapp,
.chat-panel .bi-whatsapp {
  color: #5eead4 !important;
  font-size: 1.05rem;
}
