.dd-chat {
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: 1rem;
  z-index: 110;
  display: grid;
  justify-items: end;
  gap: 0.6rem;
  color: #142b3e;
  font: 400 1rem/1.45 system-ui, sans-serif;
}

.dd-chat [hidden] { display: none !important; }
.dd-chat button { cursor: pointer; }
.dd-chat button:disabled { cursor: wait; opacity: 0.65; }
.dd-chat a { color: #00556b; font-weight: 700; text-decoration: underline; }
.dd-chat :focus-visible { outline: 3px solid #0e89a0; outline-offset: 2px; }

.dd-chat-launch,
.dd-chat-contact-toggle,
.dd-chat-send,
.dd-chat-question button {
  min-height: 44px;
  border: 0;
  border-radius: 0.6rem;
  background: #072f42;
  color: #fff;
  padding: 0.55rem 0.9rem;
  font-weight: 750;
}

.dd-chat-launch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding-inline: 1rem;
  border-radius: 999px;
  background: linear-gradient(130deg, #a1fff2, #55e9df);
  color: #072f42;
  border: 1px solid #23a4ad;
  box-shadow: 0 5px 20px #07111f45;
}

.dd-chat-panel {
  display: flex;
  width: min(26rem, calc(100vw - 1.5rem));
  max-height: min(36rem, calc(100vh - 6rem));
  max-height: min(36rem, calc(100dvh - 6rem));
  flex-direction: column;
  overflow: hidden;
  border-radius: 1.1rem;
  border: 1px solid #92c5ca;
  background: #f8fcfd;
  box-shadow: 0 12px 46px #07111f55;
}

.dd-chat-panel:not([hidden]) { animation: dd-chat-aparecer 200ms ease-out both; }
@keyframes dd-chat-aparecer {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dd-chat-panel:not([hidden]) { animation: none; }
}

.dd-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0.95rem;
  gap: 0.6rem;
  background: linear-gradient(120deg, #07111f 10%, #08455a);
  border-bottom: 2px solid #3deada;
  color: #fff;
}

.dd-chat-identity { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.dd-chat-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 2.3rem;
  height: 2.3rem;
  border-radius: 0.7rem;
  background: #82f8ec;
  color: #073247;
}
.dd-chat-icon {
  position: relative;
  display: inline-block;
  width: 1.1rem;
  height: 0.82rem;
  border: 2px solid currentColor;
  border-radius: 0.3rem;
}
.dd-chat-icon::after {
  position: absolute;
  left: 0.12rem;
  bottom: -0.22rem;
  width: 0.25rem;
  height: 0.25rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: #82f8ec;
  transform: skewY(-30deg);
  content: "";
}
.dd-chat-header h2 { color: inherit; margin: 0; font: 750 1.06rem/1.2 system-ui, sans-serif; }
.dd-chat-header p { color: #c4edf0; margin: 0.15rem 0 0; font-size: 0.875rem; }
.dd-chat-close { flex: 0 0 44px; min-height: 44px; border: 1px solid #8ed0d5; border-radius: 0.7rem; background: #ffffff0f; color: #fff; }
.dd-chat-close { font-size: 1.45rem; line-height: 1; }
.dd-chat-close:focus-visible { outline-color: #82f8ec; }
.dd-chat-content { padding: 0.9rem; overflow: auto; min-height: 0; overscroll-behavior: contain; }
.dd-chat-history { display: grid; gap: 0.45rem; max-height: 12rem; overflow: auto; }
.dd-chat-history p { margin: 0; padding: 0.55rem 0.7rem; border-radius: 0.55rem; overflow-wrap: anywhere; }
.dd-chat-reply { background: #e5f3f7; border-left: 3px solid #17a3ab; }
.dd-chat-reply strong { color: #073247; }
.dd-chat-user { background: #d1f8f1; margin-left: 1rem !important; }
.dd-chat-topics { display: flex; flex-wrap: wrap; gap: 0.36rem; margin: 0.7rem 0; }
.dd-chat-topics button { min-height: 44px; border: 1px solid #8fc5cb; border-radius: 999px; padding: 0.25rem 0.65rem; background: #fff; color: #07566a; font-weight: 700; }
.dd-chat-topics button:hover { background: #e0faf7; }
.dd-chat-question label, .dd-chat-lead label { display: grid; gap: 0.22rem; font-weight: 700; }
.dd-chat-question > div { display: flex; gap: 0.42rem; }
.dd-chat-question input, .dd-chat-lead :is(input:not([type="checkbox"]), select, textarea) {
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid #8eb2c4;
  border-radius: 0.45rem;
  background: #fff;
  color: #122b3e;
  font: inherit;
}
.dd-chat-contact-toggle { display: block; margin-top: 0.72rem; width: 100%; }
.dd-chat-contact { margin-top: 0.72rem; }
.dd-chat-lead { display: grid; gap: 0.6rem; }
.dd-chat-lead .dd-chat-consent { display: flex; align-items: flex-start; font-size: 0.88rem; font-weight: 500; }
.dd-chat-consent input { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; margin: 0.15rem 0.35rem 0 0; }
.dd-chat-status, .dd-chat-note { margin: 0; color: #314c60; font-size: 0.88rem; }
.dd-chat-status:empty { display: none; }
.dd-chat-notice { display: inline-flex; align-items: center; min-height: 44px; margin-top: 0.35rem; font-size: 0.88rem; }
.dd-chat-notice + .dd-chat-contact-toggle { margin-top: 0; }
.dd-chat-note, .contact-form-privacy { overflow-wrap: anywhere; }
.contact-form-privacy { margin: 0 0 1.25rem; color: #314c60; font-size: 0.9rem; }
.contact-form-privacy a { color: #00556b; font-weight: 700; text-decoration: underline; }
.dd-chat-alternative { display: inline-flex; align-items: center; min-height: 44px; margin-top: 0.35rem; }
@media (max-width: 820px) {
  body.nav-open .dd-chat { visibility: hidden; }
  .dd-chat { bottom: calc(4.8rem + env(safe-area-inset-bottom)); }
  .dd-chat-panel {
    max-height: min(36rem, calc(100vh - 10.5rem));
    max-height: min(36rem, calc(100dvh - 10.5rem - env(safe-area-inset-bottom)));
  }
}
