.customer-chat {
  position: fixed;
  z-index: 60;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  color: #102638;
  font-size: .875rem;
  line-height: 1.5;
}
.customer-chat > summary {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 44px;
  padding: .7rem 1.05rem;
  background: #102638;
  color: #fff;
  border: 1px solid #f4f6f947;
  border-radius: 24px;
  box-shadow: 0 5px 20px #07131e33;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.customer-chat summary::-webkit-details-marker { display: none; }
.customer-chat > summary:hover { background: #1a3b50; }
.customer-chat-icon {
  width: 17px;
  height: 14px;
  border: 1.5px solid #edb96e;
  border-radius: 5px;
  position: relative;
}
.customer-chat-icon::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 3px;
  width: 5px;
  height: 5px;
  border: solid #edb96e;
  border-width: 0 0 1.5px 1.5px;
  background: #102638;
  transform: skewY(-38deg);
}
.customer-chat[open] .customer-chat-icon { border: 0; }
.customer-chat[open] .customer-chat-icon::after {
  content: '×';
  inset: 0;
  width: auto;
  height: auto;
  border: 0;
  background: none;
  color: #edb96e;
  font: 22px/14px system-ui, sans-serif;
  transform: none;
}
.customer-chat-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: min(22rem, calc(100vw - 32px));
  max-height: calc(100vh - 11rem);
  max-height: calc(100dvh - 11rem);
  overflow: auto;
  padding: 1rem;
  border: 1px solid #dfe5e8;
  border-radius: 14px;
  background: #fafbf9;
  box-shadow: 0 12px 48px #07131e36;
}
.customer-chat-panel p { margin-bottom: .75rem; color: #405867; }
.customer-chat-panel a { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 44px; }
.customer-chat-whatsapp { padding: .65rem .75rem; margin-bottom: .35rem; border-radius: 7px; background: #e5eee9; font-weight: 600; }
.customer-chat-whatsapp:hover { background: #d5e6dc; }
.customer-chat-whatsapp small { display: block; font-size: .75rem; font-weight: 400; }
.customer-chat-message { padding-inline: .75rem; }
.customer-chat-message:hover { text-decoration: underline; }
.customer-chat :focus-visible { outline: 2px solid #a66b25; outline-offset: 3px; }
.is-home:has(.header:not(.is-scrolled)) .customer-chat {
  bottom: max(108px, calc(env(safe-area-inset-bottom) + 90px));
}

@media (max-width: 600px) {
  .customer-chat { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .is-home:has(.header:not(.is-scrolled)) .customer-chat { bottom: max(90px, calc(env(safe-area-inset-bottom) + 76px)); }
  .customer-chat > summary { padding-inline: .8rem; }
}

.customer-chat-name { font-size: 1rem; font-weight: 650; }
.customer-chat-panel [data-chat-presence] { margin: .25rem 0 .7rem; font-size: .81rem; color: #486071; }
.customer-chat-history {
  display: flex; flex-direction: column; gap: .65rem; height: clamp(6rem, 24vh, 14rem);
  padding: .75rem; overflow-y: auto; background: #eef3f3; border-radius: 8px;
  overscroll-behavior: contain;
}
.customer-chat-bubble {
  align-self: flex-start; max-width: 90%; padding: .5rem .7rem; border-radius: 9px;
  background: #fff; color: #193447; white-space: pre-wrap; overflow-wrap: anywhere;
}
.customer-chat-bubble.is-visitor { align-self: flex-end; background: #17394c; color: white; }
.customer-chat-bubble small { display: block; font-size: .7rem; opacity: .82; }
.customer-chat-form { display: flex; align-items: flex-end; gap: .5rem; margin-top: .7rem; }
.customer-chat-form textarea {
  flex: 1; min-width: 0; resize: vertical; max-height: 7rem; border: 1px solid #c2cfd4;
  border-radius: 7px; padding: .55rem; color: #102638; background: white; font: inherit; font-size: 1rem;
}
.customer-chat-form button { padding: .7rem .8rem; border: 0; border-radius: 7px; background: #153347; color: #fff; cursor: pointer; }
.customer-chat-form button:disabled { opacity: .6; cursor: wait; }
.customer-chat-panel [data-chat-status]:not(:empty) { display: block; margin-top: .4rem; color: #514938; }
.customer-chat-alternatives { margin-top: .6rem; }
.customer-chat-alternatives > summary { cursor: pointer; text-decoration: underline; padding-block: .35rem; color: #465c68; }
