.whatsapp-widget {
  position: fixed;
  z-index: 80;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(390px, calc(100vw - 36px));
  font-family: "DM Sans", Arial, sans-serif;
}

.whatsapp-launcher {
  display: inline-flex;
  float: right;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 0 18px 0 13px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  color: #fff;
  background: #25d366;
  box-shadow: 0 12px 28px rgba(15, 72, 45, .28);
  font: 800 14px/1 "DM Sans", Arial, sans-serif;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.whatsapp-launcher:hover { background: #20bd5a; box-shadow: 0 16px 34px rgba(15, 72, 45, .34); transform: translateY(-2px); }
.whatsapp-launcher:focus-visible, .whatsapp-widget button:focus-visible, .whatsapp-chat-form input:focus-visible { outline: 3px solid rgba(37, 211, 102, .32); outline-offset: 3px; }
.whatsapp-launcher svg { width: 28px; height: 28px; flex: 0 0 auto; }
.whatsapp-widget.is-open .whatsapp-launcher { display: none; }

.whatsapp-chat-panel {
  overflow: hidden;
  border: 1px solid rgba(24, 92, 57, .18);
  border-radius: 16px;
  background: #edf4ed;
  box-shadow: 0 22px 52px rgba(13, 54, 35, .3);
}

.whatsapp-chat-header {
  display: grid;
  grid-template-columns: 36px 1fr auto 30px;
  align-items: center;
  min-height: 108px;
  padding: 15px 14px;
  color: #fff;
  background: linear-gradient(135deg, #23b43e, #159d37);
}

.whatsapp-back, .whatsapp-close { width: 32px; height: 32px; border: 0; border-radius: 50%; color: #fff; background: transparent; font: 400 34px/28px Arial, sans-serif; cursor: pointer; }
.whatsapp-back { font-size: 42px; line-height: 22px; text-align: left; }
.whatsapp-close { align-self: start; font-size: 29px; line-height: 26px; }
.whatsapp-agent-copy { min-width: 0; padding-right: 10px; }
.whatsapp-agent-copy strong, .whatsapp-agent-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whatsapp-agent-copy strong { font-size: 16px; font-weight: 800; }
.whatsapp-agent-copy span { margin-top: 5px; color: rgba(255,255,255,.76); font-size: 12px; font-weight: 700; }
.whatsapp-avatar { position: relative; display: grid; width: 55px; height: 55px; place-items: center; overflow: visible; border: 3px solid rgba(255,255,255,.7); border-radius: 50%; color: #159d37; background: #e8f5e9; font-size: 20px; font-weight: 800; }
.whatsapp-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.whatsapp-avatar i { position: absolute; right: -1px; bottom: 0; width: 13px; height: 13px; border: 2px solid #19a438; border-radius: 50%; background: #a7ef6e; }

.whatsapp-chat-body { min-height: 178px; padding: 23px 18px 16px; background-color: #ecf2eb; background-image: radial-gradient(rgba(42, 111, 67, .08) 1px, transparent 1px); background-size: 13px 13px; }
.whatsapp-bubble { max-width: 91%; padding: 15px 16px 11px; border-radius: 4px 13px 13px 13px; background: #fff; box-shadow: 0 3px 10px rgba(29, 66, 44, .1); }
.whatsapp-bubble p { margin: 0; color: #254033; font-size: 14px; font-weight: 600; line-height: 1.55; }
.whatsapp-bubble small { display: block; margin-top: 8px; color: #718277; font-size: 10px; line-height: 1.4; }
.whatsapp-chat-note { margin: 14px 3px 0; color: #637266; font-size: 11px; line-height: 1.45; }

.whatsapp-chat-form { display: grid; grid-template-columns: 1fr 49px; gap: 9px; align-items: center; padding: 12px; background: #fff; }
.whatsapp-chat-form input { width: 100%; min-width: 0; height: 44px; padding: 0 13px; border: 1px solid #dce5de; border-radius: 10px; color: #244032; background: #fff; font: 14px/1.2 "DM Sans", Arial, sans-serif; }
.whatsapp-chat-form input:focus { border-color: #25b951; box-shadow: 0 0 0 3px rgba(37, 211, 102, .13); outline: 0; }
.whatsapp-chat-form button { display: grid; width: 45px; height: 44px; place-items: center; border: 0; border-radius: 10px; color: #fff; background: #159d37; cursor: pointer; }
.whatsapp-chat-form button:hover { background: #118530; }
.whatsapp-chat-form button svg { width: 23px; height: 23px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 620px) {
  .whatsapp-widget { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: min(390px, calc(100vw - 24px)); }
  .whatsapp-launcher { width: 56px; min-height: 56px; justify-content: center; padding: 0; }
  .whatsapp-launcher span { display: none; }
  .whatsapp-launcher svg { width: 30px; height: 30px; }
  .whatsapp-chat-header { min-height: 98px; }
}

@media (prefers-reduced-motion: reduce) { .whatsapp-launcher { transition: none; } }
