#cosmo-chatbot-root {
  --cosmo-brand: #0b6e4f;
  --cosmo-brand-dark: #085a40;
  --cosmo-brand-soft: #e8f5ef;
  --cosmo-bg: #ffffff;
  --cosmo-text: #14201a;
  --cosmo-muted: #5c6b63;
  --cosmo-border: #dce8e1;
  --cosmo-shadow: 0 18px 50px rgba(11, 110, 79, 0.22);
  --cosmo-radius: 18px;

  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--cosmo-text);
  line-height: 1.45;
  box-sizing: border-box;
}

#cosmo-chatbot-root *,
#cosmo-chatbot-root *::before,
#cosmo-chatbot-root *::after {
  box-sizing: border-box;
}

#cosmo-chatbot-root .cosmo-chat-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, var(--cosmo-brand) 0%, var(--cosmo-brand-dark) 100%) !important;
  color: #fff !important;
  cursor: pointer;
  box-shadow: var(--cosmo-shadow);
  display: grid;
  place-items: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  animation: cosmo-launcher-in 0.45s ease both;
  padding: 0;
}

#cosmo-chatbot-root .cosmo-chat-launcher::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--cosmo-brand);
  opacity: 0.35;
  animation: cosmo-pulse 2.4s ease-out infinite;
}

#cosmo-chatbot-root .cosmo-chat-launcher:hover {
  transform: scale(1.06);
  box-shadow: 0 20px 48px rgba(11, 110, 79, 0.32);
}

#cosmo-chatbot-root .cosmo-chat-launcher.is-open::after {
  display: none;
}

#cosmo-chatbot-root .cosmo-chat-launcher .icon-close {
  display: none;
  position: absolute;
}

#cosmo-chatbot-root .cosmo-chat-launcher.is-open .icon-chat {
  display: none;
}

#cosmo-chatbot-root .cosmo-chat-launcher.is-open .icon-close {
  display: block;
}

#cosmo-chatbot-root .cosmo-chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: min(400px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 120px));
  background: var(--cosmo-bg);
  border: 1px solid var(--cosmo-border);
  border-radius: var(--cosmo-radius);
  box-shadow: var(--cosmo-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: bottom right;
}

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

#cosmo-chatbot-root .cosmo-chat-header {
  background: linear-gradient(135deg, var(--cosmo-brand) 0%, var(--cosmo-brand-dark) 100%) !important;
  color: #ffffff !important;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

#cosmo-chatbot-root .cosmo-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

#cosmo-chatbot-root .cosmo-chat-header-text {
  flex: 1;
  min-width: 0;
}

#cosmo-chatbot-root .cosmo-chat-header h3,
#cosmo-chatbot-root .cosmo-chat-header p,
#cosmo-chatbot-root .cosmo-chat-status {
  color: #ffffff !important;
  margin: 0;
}

#cosmo-chatbot-root .cosmo-chat-header h3 {
  font-size: 1rem !important;
  font-weight: 650 !important;
  letter-spacing: 0.01em;
  line-height: 1.3 !important;
}

#cosmo-chatbot-root .cosmo-chat-status {
  margin-top: 4px !important;
  font-size: 0.78rem !important;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 6px;
}

#cosmo-chatbot-root .cosmo-chat-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7dffb3;
  box-shadow: 0 0 0 3px rgba(125, 255, 179, 0.25);
}

#cosmo-chatbot-root .cosmo-chat-close {
  border: none;
  background: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease;
  padding: 0;
}

#cosmo-chatbot-root .cosmo-chat-close:hover {
  background: rgba(255, 255, 255, 0.24) !important;
}

#cosmo-chatbot-root .cosmo-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at top right, rgba(11, 110, 79, 0.06), transparent 40%),
    linear-gradient(180deg, #f4faf7 0%, #ffffff 55%);
  scroll-behavior: smooth;
}

#cosmo-chatbot-root .cosmo-msg-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: cosmo-msg-in 0.28s ease both;
}

#cosmo-chatbot-root .cosmo-msg-row.user {
  align-items: flex-end;
}

#cosmo-chatbot-root .cosmo-msg-row.bot {
  align-items: flex-start;
}

#cosmo-chatbot-root .cosmo-msg {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
  word-wrap: break-word;
  white-space: pre-wrap;
  margin: 0;
}

#cosmo-chatbot-root .cosmo-msg.bot {
  background: #fff !important;
  border: 1px solid var(--cosmo-border);
  color: var(--cosmo-text) !important;
  border-bottom-left-radius: 5px;
  box-shadow: 0 4px 14px rgba(20, 32, 26, 0.04);
}

#cosmo-chatbot-root .cosmo-msg.user {
  background: var(--cosmo-brand) !important;
  color: #ffffff !important;
  border-bottom-right-radius: 5px;
  box-shadow: 0 6px 16px rgba(11, 110, 79, 0.2);
}

#cosmo-chatbot-root .cosmo-msg.typing {
  padding: 14px 16px;
  min-width: 56px;
}

#cosmo-chatbot-root .cosmo-typing-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

#cosmo-chatbot-root .cosmo-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cosmo-brand);
  opacity: 0.45;
  animation: cosmo-dot 1.2s ease-in-out infinite;
}

#cosmo-chatbot-root .cosmo-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

#cosmo-chatbot-root .cosmo-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

#cosmo-chatbot-root .cosmo-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: #fff;
}

#cosmo-chatbot-root .cosmo-quick-replies.hidden {
  display: none;
}

#cosmo-chatbot-root .cosmo-chip {
  border: 1px solid var(--cosmo-border) !important;
  background: var(--cosmo-brand-soft) !important;
  color: var(--cosmo-brand-dark) !important;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  line-height: 1.2;
}

#cosmo-chatbot-root .cosmo-chip:hover {
  transform: translateY(-1px);
  background: #d8f0e4 !important;
  border-color: #b7dccb !important;
}

#cosmo-chatbot-root .cosmo-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px 10px;
  border-top: 1px solid var(--cosmo-border);
  background: #fff;
  align-items: flex-end;
  margin: 0;
}

#cosmo-chatbot-root .cosmo-chat-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--cosmo-border) !important;
  border-radius: 12px !important;
  padding: 11px 12px !important;
  font: inherit !important;
  font-size: 0.9rem !important;
  min-height: 44px;
  max-height: 110px;
  line-height: 1.4 !important;
  outline: none !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color: var(--cosmo-text) !important;
  background: #fff !important;
  width: auto !important;
  box-shadow: none !important;
  appearance: none;
  -moz-appearance: textfield;
}

#cosmo-chatbot-root .cosmo-chat-input textarea::-webkit-outer-spin-button,
#cosmo-chatbot-root .cosmo-chat-input textarea::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#cosmo-chatbot-root .cosmo-chat-input textarea:focus {
  border-color: var(--cosmo-brand) !important;
  box-shadow: 0 0 0 3px rgba(11, 110, 79, 0.12) !important;
}

#cosmo-chatbot-root .cosmo-chat-input button[type="submit"] {
  border: none !important;
  border-radius: 12px !important;
  background: var(--cosmo-brand) !important;
  color: #ffffff !important;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
  padding: 0 !important;
  margin: 0 !important;
}

#cosmo-chatbot-root .cosmo-chat-input button[type="submit"]:hover:not(:disabled) {
  background: var(--cosmo-brand-dark) !important;
  transform: translateY(-1px);
}

#cosmo-chatbot-root .cosmo-chat-input button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#cosmo-chatbot-root .cosmo-chat-footer {
  text-align: center;
  font-size: 0.68rem !important;
  color: var(--cosmo-muted) !important;
  padding: 0 12px 10px;
  background: #fff;
  margin: 0;
}

@keyframes cosmo-launcher-in {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cosmo-pulse {
  0% {
    transform: scale(1);
    opacity: 0.4;
  }
  70% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes cosmo-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cosmo-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  #cosmo-chatbot-root {
    bottom: 14px;
    right: 14px;
  }

  #cosmo-chatbot-root .cosmo-chat-panel {
    height: min(78vh, 620px);
    width: calc(100vw - 28px);
  }
}
