.chat-widget {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 90;
  font-family: "Manrope", "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #123e59;
}

.chat-launch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px 18px 10px 12px;
  border: 1px solid rgba(18, 62, 89, 0.22);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(13, 33, 48, 0.18);
  color: #123e59;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.chat-launch:hover,
.chat-launch:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px rgba(13, 33, 48, 0.24);
}

.chat-launch strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1;
}

.chat-launch span:not([class]) {
  display: block;
  margin-top: 4px;
  color: #587281;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-dog {
  position: relative;
  width: 60px;
  height: 52px;
  flex: 0 0 auto;
}

.chat-dog-body {
  position: absolute;
  left: 10px;
  bottom: 5px;
  width: 38px;
  height: 26px;
  border: 3px solid #123e59;
  border-radius: 19px 19px 15px 15px;
  background: #f6f1e8;
}

.chat-dog-head {
  position: absolute;
  left: 7px;
  top: 4px;
  width: 36px;
  height: 34px;
  border: 3px solid #123e59;
  border-radius: 50% 50% 46% 46%;
  background: #fffdf8;
}

.chat-dog-ear {
  position: absolute;
  top: 1px;
  width: 15px;
  height: 25px;
  border: 3px solid #123e59;
  background: #b8d7e7;
}

.chat-dog-ear.left {
  left: 2px;
  border-radius: 15px 4px 14px 10px;
  transform: rotate(-18deg);
}

.chat-dog-ear.right {
  left: 31px;
  border-radius: 4px 15px 10px 14px;
  transform: rotate(18deg);
}

.chat-dog-eye {
  position: absolute;
  top: 17px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #123e59;
}

.chat-dog-eye.left {
  left: 18px;
}

.chat-dog-eye.right {
  left: 31px;
}

.chat-dog-nose {
  position: absolute;
  left: 24px;
  top: 24px;
  width: 7px;
  height: 5px;
  border-radius: 50%;
  background: #d43d36;
}

.chat-dog-tail {
  position: absolute;
  right: 1px;
  bottom: 24px;
  width: 18px;
  height: 24px;
  border-top: 4px solid #123e59;
  border-right: 4px solid #123e59;
  border-radius: 0 20px 0 0;
  transform-origin: 2px 20px;
  animation: chat-tail-wag 620ms ease-in-out infinite alternate;
}

@keyframes chat-tail-wag {
  from {
    transform: rotate(-16deg);
  }

  to {
    transform: rotate(18deg);
  }
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 86px;
  width: min(420px, calc(100vw - 28px));
  max-height: min(680px, calc(100dvh - 118px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(18, 62, 89, 0.18);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 26px 80px rgba(9, 30, 46, 0.26);
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #123e59, #0f2e43);
  color: #fff;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header .chat-dog {
  transform: scale(0.72);
  transform-origin: center;
}

.chat-header .chat-dog-head,
.chat-header .chat-dog-body {
  background: #fff;
}

.chat-header .chat-dog-ear {
  background: #dcebf2;
}

.chat-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
}

.chat-header p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.76rem;
}

.chat-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.chat-messages {
  min-height: 260px;
  max-height: 430px;
  overflow-y: auto;
  padding: 18px;
  background:
    radial-gradient(circle at 14% 8%, rgba(212, 61, 54, 0.06), transparent 28%),
    linear-gradient(180deg, #f8fbfc 0%, #ffffff 100%);
}

.chat-message {
  max-width: 92%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.chat-message.bot {
  border-top-left-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(18, 62, 89, 0.08);
}

.chat-message.user {
  margin-left: auto;
  border-top-right-radius: 6px;
  background: #123e59;
  color: #fff;
}

.chat-message strong {
  font-weight: 900;
}

.chat-message ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.chat-message li + li {
  margin-top: 5px;
}

.chat-message a {
  color: #d43d36;
  font-weight: 900;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 14px;
  background: #fff;
}

.chat-suggestions button {
  border: 1px solid rgba(18, 62, 89, 0.14);
  border-radius: 999px;
  padding: 8px 10px;
  background: #f7fafb;
  color: #123e59;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid rgba(18, 62, 89, 0.12);
  background: #fff;
}

.chat-form input {
  min-width: 0;
  border: 1px solid rgba(18, 62, 89, 0.16);
  border-radius: 999px;
  padding: 13px 14px;
  color: #123e59;
  font: inherit;
}

.chat-form button {
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: #d43d36;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 640px) {
  .chat-widget {
    right: 12px;
    bottom: 12px;
  }

  .chat-launch {
    min-height: 62px;
    padding: 8px 12px 8px 9px;
  }

  .chat-launch span:not([class]) {
    display: none;
  }

  .chat-panel {
    right: -2px;
    bottom: 76px;
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 98px);
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-dog-tail {
    animation: none;
  }

  .chat-launch,
  .chat-panel {
    transition: none;
  }
}
