.consult-chat [hidden],
.consult-chat[hidden],
.consult-chat[data-chat-opened] .consult-chat-launcher,
html.consult-chat-ready .floating-contact {
  display: none !important;
}

.consult-chat {
  --chat-green: #12634d;
  --chat-green-dark: #0c4b3b;
  --chat-tint: #e6f4eb;
  --chat-surface: #f5f9f7;
  --chat-border: #cfdfd8;
  --chat-side: max(clamp(12px, 2.4vw, 28px), env(safe-area-inset-right, 0px));
  --chat-bottom: var(--bottom-overlay-offset);
  position: fixed;
  z-index: 35;
  inset-inline-end: var(--chat-side);
  inset-block-end: var(--chat-bottom);
  color: var(--ink);
}

@media (max-width: 960px) {
  .consult-chat {
    --chat-bottom: calc(var(--bottom-overlay-offset) + var(--analytics-clearance));
  }
}

html[data-accessibility="on"] .consult-chat {
  z-index: 41;
}

html[data-accessibility="on"] .consult-chat[data-chat-opened] {
  --chat-bottom: var(--bottom-overlay-offset);
}

html[data-accessibility="on"] body.menu-open .consult-chat {
  visibility: hidden;
}

.consult-chat-launcher {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 56px;
  block-size: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #138050;
  color: #fff;
  box-shadow: 0 7px 22px #143e2a35;
}

.consult-chat-launcher:hover {
  background: var(--chat-green);
}

.consult-chat-launcher .icon,
.consult-chat-whatsapp .icon {
  inline-size: 26px;
  block-size: 26px;
  fill: currentColor;
  stroke: none;
}

.consult-chat-badge {
  position: absolute;
  inset-block-start: -4px;
  inset-inline-end: -4px;
  display: grid;
  place-items: center;
  inline-size: 21px;
  block-size: 21px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #bd2b35;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.consult-chat-panel {
  display: flex;
  flex-direction: column;
  inline-size: min(390px, calc(100vw - var(--chat-side) - max(12px, env(safe-area-inset-left, 0px))));
  max-block-size: min(550px, calc(100vh - var(--chat-bottom) - 12px));
  max-block-size: min(550px, calc(100dvh - var(--chat-bottom) - 12px));
  overflow: hidden;
  border: 1px solid var(--chat-border);
  border-radius: 18px;
  background: var(--chat-surface);
  box-shadow: 0 14px 42px #172a4335;
}

.consult-chat-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  background: radial-gradient(ellipse at 18% 0, #197259 0, var(--chat-green-dark) 80%);
  color: #fff;
}

.consult-chat-avatar {
  flex: 0 0 43px;
  inline-size: 43px;
  block-size: 43px;
  border: 1px solid #fff9;
  border-radius: 50%;
  background: #dcece3;
  object-fit: cover;
  object-position: center 26%;
}

.consult-chat-heading {
  flex: 1;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.consult-chat-heading :is(h2, h3, strong) {
  display: block;
  margin: 0;
  color: inherit;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.consult-chat-heading :is(p, small) {
  display: block;
  margin: 3px 0 0;
  color: #ecf8f2;
  font-size: 12px;
  line-height: 1.35;
}

.consult-chat-close {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 1px solid #d6f1e53b;
  border-radius: 50%;
  background: #ffffff10;
  color: inherit;
}

.consult-chat-close:hover {
  background: #ffffff24;
}

.consult-chat-close .icon {
  inline-size: 17px;
  block-size: 17px;
}

.consult-chat-header :focus-visible {
  outline-color: #fff;
  outline-offset: 3px;
}

.consult-chat-scroll {
  min-block-size: 0;
  max-block-size: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  scrollbar-width: thin;
}

.consult-chat-messages {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.consult-chat-message {
  justify-self: start;
  max-inline-size: min(100%, 33ch);
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--chat-border);
  border-radius: 4px 14px 14px;
  background: #fff;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.consult-chat-message[data-chat-speaker="visitor"] {
  justify-self: end;
  border-color: #c9e5d3;
  border-radius: 14px 4px 14px 14px;
  background: var(--chat-tint);
}

.consult-chat-typing {
  inline-size: fit-content;
  margin: 8px 0 0;
  color: #48635a;
  font-size: 13px;
}

.consult-chat-typing span {
  display: inline-block;
  inline-size: 5px;
  block-size: 5px;
  margin-inline: 2px;
  border-radius: 50%;
  background: currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  .consult-chat-typing span {
    animation: consult-chat-typing 1.2s ease-in-out infinite;
  }
  .consult-chat-typing span:nth-child(2) { animation-delay: 150ms; }
  .consult-chat-typing span:nth-child(3) { animation-delay: 300ms; }
}

@keyframes consult-chat-typing {
  0%, 60%, 100% { opacity: 0.5; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.consult-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 12px;
}

.consult-chat-callback {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding: 6px 12px;
  border: 1px solid #91b7a4;
  border-radius: 16px;
  background: #fff;
  color: var(--chat-green-dark);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
  text-align: start;
}

.consult-chat-callback:hover {
  background: var(--chat-tint);
}

.consult-chat-actions > .consult-chat-form {
  display: grid;
  flex: 1 1 100%;
  min-inline-size: 0;
  gap: 10px;
  margin-block-start: 3px;
  padding: 12px;
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  background: #fff;
}

.consult-chat-actions > .consult-chat-form :is(.field, .consent-check, .booking-status, .form-help) {
  margin: 0;
}

.consult-chat-actions > .consult-chat-form .button {
  min-block-size: 46px;
  padding: 8px 13px;
  font-size: 13px;
  line-height: 1.35;
}

.consult-chat-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-block-size: 44px;
  padding: 7px 13px;
  border: 1px solid var(--chat-green);
  border-radius: 24px;
  background: var(--chat-green);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.consult-chat-whatsapp:hover {
  background: var(--chat-green-dark);
}

.consult-chat-whatsapp .icon {
  flex: none;
  inline-size: 20px;
  block-size: 20px;
}

.consult-chat-questions {
  flex: none;
  padding: 9px 12px 12px;
  border-block-start: 1px solid var(--chat-border);
  background: #fff;
}

.consult-chat-questions label {
  display: block;
  margin-block-end: 4px;
  color: #466255;
  font-size: 12px;
  line-height: 1.4;
}

.consult-chat-questions small {
  display: block;
  margin-block-start: 5px;
  color: #466255;
  font-size: 11px;
  line-height: 1.4;
}

.consult-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.consult-chat-input-row :is(input, textarea) {
  flex: 1;
  min-inline-size: 0;
  inline-size: 100%;
  min-block-size: 44px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #9fb9ad;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
}

#consult-chat-answer:focus {
  border-color: var(--a11y-fg, var(--chat-green));
  outline: 2px solid var(--a11y-fg, var(--chat-green));
  outline-offset: -2px;
}

.consult-chat-input-row button {
  display: grid;
  flex: none;
  min-inline-size: 44px;
  min-block-size: 44px;
  place-items: center;
  padding: 5px 8px;
  border: 1px solid var(--chat-green);
  border-radius: 12px;
  background: var(--chat-green);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.consult-chat-input-row button:hover {
  background: var(--chat-green-dark);
}

.consult-chat-input-row button:disabled {
  opacity: 0.55;
  cursor: default;
}

.consult-chat-input-row button .icon {
  inline-size: 20px;
  block-size: 20px;
}

.consult-chat-error {
  margin: 5px 0 0;
  color: #9f2429;
  font-size: 12px;
  line-height: 1.45;
}

.consult-chat-error:empty {
  display: none;
}

html[data-accessibility="on"] .consult-chat :is(
  .consult-chat-launcher, .consult-chat-panel, .consult-chat-header, .consult-chat-close,
  .consult-chat-message, .consult-chat-whatsapp, .consult-chat-callback,
  .consult-chat-form, .consult-chat-questions, .consult-chat-input-row button
) {
  border-color: var(--a11y-fg);
  background-color: var(--a11y-bg) !important;
  color: var(--a11y-fg) !important;
}

html[data-accessibility="on"] .consult-chat-launcher {
  border: 2px solid var(--a11y-fg);
}

html[data-accessibility="on"] .consult-chat-badge {
  border-color: var(--a11y-bg);
  background-color: var(--a11y-fg) !important;
  color: var(--a11y-bg) !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

html[data-accessibility="on"] .consult-chat-header {
  border-block-end: 1px solid var(--a11y-fg);
}

html[data-accessibility="on"] .consult-chat-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

html[data-accessibility="on"] .consult-chat-scroll {
  flex: none;
  max-block-size: min(220px, 44dvh);
  overscroll-behavior: auto;
}

html[data-accessibility="on"] .consult-chat-input-row {
  flex-wrap: wrap;
}

html[data-accessibility="on"] .consult-chat-input-row :is(input, textarea) {
  flex: 1 0 100%;
}

@media (max-width: 360px) {
  .consult-chat-header { gap: 8px; padding-inline: 10px; }
  .consult-chat-avatar { flex-basis: 37px; inline-size: 37px; block-size: 37px; }
  .consult-chat-scroll { padding: 10px; }
  .consult-chat-questions { padding-inline: 10px; }
}
