.consult-chat {
  width: min(100%, 500px);
  justify-self: end;
  align-self: center;
  overflow: hidden;
  border: 1px solid rgba(216, 208, 193, 0.94);
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: 0 24px 62px rgba(47, 84, 134, 0.16), 0 8px 22px rgba(37, 37, 38, 0.07);
}

.consult-chat-header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: 62px;
  padding: 0.72rem 0.9rem;
  background: var(--ink);
  color: var(--white);
}

.consult-chat-dots {
  display: flex;
  gap: 0.24rem;
}

.consult-chat-dots span,
.consult-chat-minimize {
  display: inline-flex;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.72);
}

.consult-chat-minimize {
  justify-self: end;
  width: 22px;
  height: 2px;
}

.consult-chat-person {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.consult-chat-avatar,
.chat-avatar,
.chat-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.consult-chat-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--periwinkle), var(--paper));
  color: var(--periwinkle-deep);
  font-weight: 950;
}

.consult-chat-person strong,
.consult-chat-person span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.consult-chat-person strong {
  font-size: 0.98rem;
  line-height: 1.05;
}

.consult-chat-person span {
  margin-top: 0.1rem;
  color: rgba(255, 253, 246, 0.72);
  font-size: 0.74rem;
  font-weight: 760;
}

.consult-chat-body {
  display: grid;
  gap: 0.9rem;
  min-height: 410px;
  padding: 1.2rem;
  background: linear-gradient(180deg, #fffdf6, #f8f3e8);
}

.chat-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: end;
  gap: 0.62rem;
}

.chat-row.is-user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}

.chat-stack {
  display: grid;
  min-width: 0;
  gap: 0.5rem;
  justify-items: start;
}

.chat-icon,
.chat-avatar {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(196, 208, 239, 0.7);
  background: rgba(196, 208, 239, 0.24);
  color: var(--periwinkle-deep);
}

.chat-avatar {
  border-color: rgba(143, 167, 127, 0.34);
  background: var(--paper-deep);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 950;
}

.chat-bubble {
  max-width: min(100%, 330px);
  margin: 0;
  padding: 0.82rem 0.95rem;
  border: 1px solid rgba(216, 208, 193, 0.82);
  border-radius: 8px 8px 8px 2px;
  background: rgba(255, 253, 246, 0.96);
  color: #34342f;
  box-shadow: 0 10px 22px rgba(47, 84, 134, 0.07);
  font-size: 0.93rem;
  font-weight: 720;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.chat-row.is-user .chat-bubble {
  border-color: rgba(47, 84, 134, 0.88);
  border-radius: 8px 8px 2px 8px;
  background: var(--periwinkle-deep);
  color: var(--white);
  box-shadow: 0 14px 28px rgba(47, 84, 134, 0.24);
}

.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chat-quick-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.4rem 0.7rem;
  border: 1px solid #cfc6b6;
  border-radius: 7px;
  background: #fffdf6;
  color: #373833;
  font-size: 0.8rem;
  font-weight: 900;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.chat-quick-actions a:hover {
  border-color: var(--periwinkle-deep);
  color: var(--periwinkle-deep);
  transform: translateY(-1px);
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.15rem;
  padding: 0.72rem 0.76rem 0.72rem 0.95rem;
  border: 1px solid rgba(216, 208, 193, 0.94);
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.chat-input span {
  min-width: 0;
  color: #77736a;
  font-size: 0.9rem;
  font-weight: 760;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-tools {
  display: flex;
  align-items: center;
  gap: 0.38rem;
}

.chat-tool,
.chat-send {
  display: inline-flex;
  width: 31px;
  height: 31px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #4a4b45;
}

.chat-tool {
  border: 1px solid rgba(216, 208, 193, 0.78);
  background: rgba(248, 243, 232, 0.8);
}

.chat-send {
  background: var(--periwinkle-deep);
  color: var(--white);
}

.chat-tool svg,
.chat-send svg,
.chat-icon svg {
  width: 17px;
  height: 17px;
}

html.chat-module-ready .contact-section .appointment-form {
  display: none !important;
}

html.chat-contact-active .floating-whatsapp {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.94);
}

@media (max-width: 1020px) {
  .consult-chat {
    justify-self: stretch;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 700px) {
  .consult-chat {
    border-radius: 8px;
  }

  .consult-chat-header {
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    padding: 0.66rem 0.72rem;
  }

  .consult-chat-body {
    min-height: 385px;
    padding: 0.95rem;
  }

  .chat-bubble {
    max-width: min(100%, 282px);
    font-size: 0.88rem;
  }

  .chat-quick-actions a {
    flex: 1 1 132px;
    min-width: 0;
  }

  .chat-input {
    gap: 0.42rem;
    padding-left: 0.78rem;
  }

  .chat-tool,
  .chat-send {
    width: 29px;
    height: 29px;
  }
}
