:root {
  --rm-chat-blue: #2864e8;
  --rm-chat-blue-dark: #174fc8;
  --rm-chat-ink: #101828;
  --rm-chat-muted: #607089;
  --rm-chat-line: #dce5f1;
  --rm-chat-soft: #f4f7fc;
}

.rm-chatbot,
.rm-chatbot * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.rm-chatbot {
  position: fixed;
  z-index: 2147482000;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  color: var(--rm-chat-ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.rm-chatbot .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.rm-chat-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-left: auto;
  overflow: visible;
  border: 1px solid rgba(40, 100, 232, .16);
  border-radius: 21px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(20, 51, 102, .2);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.rm-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 46px rgba(20, 51, 102, .25);
}

.rm-chat-launcher:focus-visible,
.rm-chatbot button:focus-visible,
.rm-chatbot textarea:focus-visible,
.rm-chatbot a:focus-visible {
  outline: 3px solid rgba(40, 100, 232, .3);
  outline-offset: 2px;
}

.rm-chat-launcher img {
  display: block;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  object-fit: cover;
}

.rm-chat-notice {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #20a66a;
}

.rm-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: grid;
  grid-template-rows: auto auto minmax(170px, 1fr) auto auto auto;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 116px));
  height: min(620px, calc(100dvh - 116px));
  overflow: hidden;
  border: 1px solid var(--rm-chat-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 35, 72, .24);
  transform-origin: bottom right;
  animation: rm-chat-in .2s ease both;
}

.rm-chat-panel[hidden] {
  display: none !important;
}

@keyframes rm-chat-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.rm-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 13px 14px 13px 16px;
  border-bottom: 1px solid #e9eef6;
  background: #fff;
}

.rm-chat-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.rm-chat-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 43px;
  height: 43px;
  overflow: hidden;
  border-radius: 13px;
  background: #eef4ff;
}

.rm-chat-avatar img {
  width: 39px;
  height: 39px;
  border-radius: 11px;
  object-fit: cover;
}

.rm-chat-brand strong,
.rm-chat-brand small {
  display: block;
}

.rm-chat-brand strong {
  color: var(--rm-chat-ink);
  font-size: 16px;
  font-weight: 850;
}

.rm-chat-brand small {
  margin-top: 1px;
  color: var(--rm-chat-muted);
  font-size: 12px;
}

.rm-chat-brand small i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #20a66a;
}

.rm-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rm-chat-header-actions button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #5f6f86;
  cursor: pointer;
}

.rm-chat-header-actions button:hover {
  background: #f1f5fb;
  color: var(--rm-chat-blue);
}

.rm-chat-header-actions svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rm-chat-language {
  display: flex;
  gap: 5px;
  padding: 9px 14px 0;
  background: #fff;
}

.rm-chat-language button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f3f6fb;
  color: #607089;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.rm-chat-language button.is-active {
  border-color: #c9dbff;
  background: #eaf1ff;
  color: var(--rm-chat-blue);
}

.rm-chat-messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 15px 14px 10px;
  background: linear-gradient(180deg, #fff 0%, #f8faff 100%);
  scrollbar-width: thin;
  scrollbar-color: #c8d5e8 transparent;
}

.rm-chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 11px;
}

.rm-chat-message.is-user {
  align-items: flex-end;
}

.rm-chat-bubble {
  max-width: 88%;
  border: 1px solid #dfe7f2;
  border-radius: 16px 16px 16px 5px;
  background: #fff;
  color: #26354a;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 12px rgba(15, 35, 72, .04);
}

.rm-chat-message.is-user .rm-chat-bubble {
  border-color: var(--rm-chat-blue);
  border-radius: 16px 16px 5px 16px;
  background: var(--rm-chat-blue);
  color: #fff;
}

.rm-chat-message.is-error .rm-chat-bubble {
  border-color: #ffd2d2;
  background: #fff1f1;
  color: #9d2727;
}

.rm-chat-links {
  display: grid;
  max-width: 88%;
  gap: 5px;
  margin-top: 6px;
}

.rm-chat-links a {
  display: block;
  border-radius: 9px;
  background: #eaf1ff;
  color: var(--rm-chat-blue);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.rm-chat-links a:hover {
  background: #dce8ff;
}

.rm-chat-whatsapp {
  display: inline-flex;
  align-items: center;
  max-width: 88%;
  min-height: 42px;
  gap: 8px;
  margin-top: 7px;
  border: 1px solid #ccebd9;
  border-radius: 12px;
  background: #ecfbf2;
  color: #137a43;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(20, 135, 75, .08);
}

.rm-chat-whatsapp:hover {
  border-color: #9edab8;
  background: #ddf8e8;
  color: #0d6536;
}

.rm-chat-whatsapp svg {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rm-chat-typing .rm-chat-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rm-chat-typing .rm-chat-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8ba2c2;
  animation: rm-chat-dot 1s infinite ease-in-out;
}

.rm-chat-typing .rm-chat-bubble span:nth-child(2) { animation-delay: .12s; }
.rm-chat-typing .rm-chat-bubble span:nth-child(3) { animation-delay: .24s; }

.rm-chat-typing .rm-chat-bubble em {
  margin-left: 4px;
  color: #708098;
  font-size: 11px;
  font-style: normal;
}

@keyframes rm-chat-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.rm-chat-quick {
  display: flex;
  overflow-x: auto;
  gap: 7px;
  padding: 4px 14px 10px;
  background: #f8faff;
  scrollbar-width: none;
}

.rm-chat-quick::-webkit-scrollbar {
  display: none;
}

.rm-chat-quick[hidden] {
  display: none;
}

.rm-chat-quick button {
  flex: 0 0 auto;
  min-height: 33px;
  border: 1px solid #d4e0f2;
  border-radius: 999px;
  background: #fff;
  color: #30425b;
  padding: 6px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.rm-chat-quick button:hover {
  border-color: #9dbbfa;
  color: var(--rm-chat-blue);
}

.rm-chat-form {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e4eaf3;
  background: #fff;
}

.rm-chat-form textarea {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 112px;
  resize: none;
  border: 1px solid #cfdbea;
  border-radius: 14px;
  background: #fff;
  color: var(--rm-chat-ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  box-shadow: none;
}

.rm-chat-form textarea::placeholder {
  color: #8b98aa;
}

.rm-chat-send {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--rm-chat-blue);
  color: #fff;
  cursor: pointer;
}

.rm-chat-send:hover {
  background: var(--rm-chat-blue-dark);
}

.rm-chat-send svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.rm-chat-form.is-busy .rm-chat-send {
  opacity: .55;
  cursor: wait;
}

.rm-chat-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

.rm-chat-privacy {
  margin: 0;
  padding: 0 14px 10px;
  background: #fff;
  color: #8390a2;
  font-size: 10px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  html.rm-chat-open-mobile,
  html.rm-chat-open-mobile body {
    overflow: hidden !important;
  }

  .rm-chatbot {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .rm-chat-launcher {
    width: 56px;
    height: 56px;
    border-radius: 19px;
  }

  .rm-chat-launcher img {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .rm-chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    transform-origin: bottom center;
  }

  .rm-chat-header {
    min-height: calc(68px + env(safe-area-inset-top));
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .rm-chat-privacy {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .rm-chat-panel,
  .rm-chat-launcher,
  .rm-chat-typing .rm-chat-bubble span {
    animation: none !important;
    transition: none !important;
  }
}


/* Keep the selected chatbot image visible despite theme image rules. */
.rm-chatbot .rm-chat-launcher > img {
  display: block !important;
  width: 50px !important;
  min-width: 50px !important;
  max-width: 50px !important;
  height: 50px !important;
  object-fit: cover;
}

@media (max-width: 640px) {
  .rm-chatbot .rm-chat-launcher > img {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    height: 46px !important;
  }
}

.rm-chatbot .rm-chat-launcher {
  padding: 0 !important;
}


/* Larger launcher with a short invitation above it. */
.rm-chat-prompt {
  display: block;
  width: max-content;
  max-width: min(230px, calc(100vw - 36px));
  margin: 0 0 10px auto;
  padding: 9px 12px;
  border: 1px solid #dce5f1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20, 51, 102, .14);
  color: var(--rm-chat-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.rm-chatbot.is-open .rm-chat-prompt {
  display: none;
}

.rm-chatbot .rm-chat-launcher {
  width: 72px !important;
  height: 72px !important;
  border-radius: 24px;
}

.rm-chatbot .rm-chat-launcher > img {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  height: 60px !important;
  border-radius: 18px;
}

.rm-chatbot .rm-chat-panel {
  bottom: 86px;
}

@media (max-width: 640px) {
  .rm-chat-prompt {
    margin-bottom: 8px;
    padding: 8px 11px;
    font-size: 13px;
  }

  .rm-chatbot .rm-chat-launcher {
    width: 64px !important;
    height: 64px !important;
    border-radius: 21px;
  }

  .rm-chatbot .rm-chat-launcher > img {
    width: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    height: 52px !important;
    border-radius: 16px;
  }
}
