/* Floating WhatsApp chat bubble */
.sdh-wa {
  --wa-green: #25d366;
  --wa-green-deep: #128c7e;
  --wa-teal: #075e54;
  --wa-paper: #efeae2;
  --wa-bubble: #ffffff;
  --wa-ink: #111b21;
  --wa-muted: #667781;
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 99990;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--wa-ink);
  line-height: 1.45;
}
.sdh-wa *, .sdh-wa *::before, .sdh-wa *::after { box-sizing: border-box; }
.sdh-wa [hidden] { display: none !important; }

/* Launcher */
.sdh-wa__launcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  text-decoration: none;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  animation: sdh-wa-float 4.5s ease-in-out infinite;
}
.sdh-wa__orb {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  flex: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg, #5cf08f 0%, var(--wa-green) 45%, var(--wa-green-deep) 100%);
  box-shadow:
    0 14px 30px -8px rgba(18, 140, 126, .65),
    0 4px 10px rgba(0, 0, 0, .12),
    inset 0 -4px 10px rgba(7, 94, 84, .35),
    inset 0 2px 2px rgba(255, 255, 255, .6);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s ease;
}
.sdh-wa__orb::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(255, 255, 255, .85) 82%, transparent 92%);
  -webkit-mask: radial-gradient(circle, transparent 31px, #000 32px);
          mask: radial-gradient(circle, transparent 31px, #000 32px);
  animation: sdh-wa-spin 3.2s linear infinite;
  opacity: .8;
}
.sdh-wa__glyph { width: 34px; height: 34px; filter: drop-shadow(0 2px 2px rgba(7, 94, 84, .35)); transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), opacity .25s; }
.sdh-wa__x { position: absolute; width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; opacity: 0; transform: rotate(-90deg) scale(.5); transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), opacity .25s; }
.sdh-wa__launcher:hover .sdh-wa__orb,
.sdh-wa__launcher:focus-visible .sdh-wa__orb { transform: scale(1.08) rotate(-6deg); box-shadow: 0 18px 38px -8px rgba(18, 140, 126, .75), 0 4px 10px rgba(0, 0, 0, .14), inset 0 -4px 10px rgba(7, 94, 84, .35), inset 0 2px 2px rgba(255, 255, 255, .6); }
.sdh-wa__launcher:focus-visible { outline: none; }
.sdh-wa__launcher:focus-visible .sdh-wa__orb { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px var(--wa-teal); }

.sdh-wa__ring {
  position: absolute;
  right: 0;
  top: 0;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 2px solid var(--wa-green);
  animation: sdh-wa-ping 2.6s cubic-bezier(.2, .6, .35, 1) infinite;
  pointer-events: none;
}
.sdh-wa__ring--late { animation-delay: 1.3s; }

.sdh-wa__badge {
  position: absolute;
  z-index: 3;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 2px solid #fff;
  background: #ff3b30;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 10px rgba(255, 59, 48, .45);
  animation: sdh-wa-pop .5s .8s cubic-bezier(.34, 1.56, .64, 1) both;
}

.sdh-wa__label {
  position: absolute;
  z-index: 1;
  right: 52px;
  top: 50%;
  white-space: nowrap;
  padding: 10px 26px 10px 18px;
  border-radius: 999px 0 0 999px;
  background: #fff;
  color: var(--wa-teal);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 10px 24px -10px rgba(7, 94, 84, .45), 0 0 0 1px rgba(7, 94, 84, .08);
  transform: translate(16px, -50%) scaleX(.6);
  transform-origin: right center;
  opacity: 0;
  pointer-events: none;
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), opacity .2s;
}
.sdh-wa__launcher:hover .sdh-wa__label,
.sdh-wa__launcher:focus-visible .sdh-wa__label { opacity: 1; transform: translate(0, -50%) scaleX(1); }

/* Open state */
.sdh-wa.is-open .sdh-wa__launcher { animation: none; }
.sdh-wa.is-open .sdh-wa__glyph { opacity: 0; transform: rotate(90deg) scale(.4); }
.sdh-wa.is-open .sdh-wa__x { opacity: 1; transform: none; }
.sdh-wa.is-open .sdh-wa__ring,
.sdh-wa.is-open .sdh-wa__badge,
.sdh-wa.is-open .sdh-wa__label { display: none; }
.sdh-wa.is-open .sdh-wa__orb::after { animation: none; opacity: 0; }

/* Teaser bubble */
.sdh-wa__teaser {
  position: absolute;
  right: 6px;
  bottom: 84px;
  width: 268px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 34px 14px 14px;
  border-radius: 18px 18px 4px 18px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
          backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 24px 50px -18px rgba(17, 27, 33, .45), 0 0 0 1px rgba(17, 27, 33, .06);
  animation: sdh-wa-rise .55s cubic-bezier(.34, 1.56, .64, 1) both;
}
.sdh-wa__teaser img { width: 36px; height: 36px; flex: none; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wa-green); }
.sdh-wa__teaser p { margin: 0; font-size: 14px; color: var(--wa-ink); }
.sdh-wa__teaser strong { display: block; font-size: 14.5px; margin-bottom: 2px; }
.sdh-wa__teaser span { color: var(--wa-muted); }
.sdh-wa__teaser-close {
  position: absolute; top: 6px; right: 8px; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: transparent; color: var(--wa-muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.sdh-wa__teaser-close:hover, .sdh-wa__teaser-close:focus-visible { background: rgba(17, 27, 33, .07); color: var(--wa-ink); outline: none; }
.sdh-wa__teaser { cursor: pointer; }

/* Panel */
.sdh-wa__panel {
  position: absolute;
  right: 0;
  bottom: 84px;
  width: 372px;
  max-height: min(600px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--wa-paper);
  box-shadow: 0 40px 80px -24px rgba(7, 40, 36, .55), 0 0 0 1px rgba(7, 94, 84, .12);
  transform-origin: calc(100% - 33px) calc(100% + 40px);
  animation: sdh-wa-open .5s cubic-bezier(.22, 1.25, .36, 1) both;
}
.sdh-wa.is-closing .sdh-wa__panel { animation: sdh-wa-close .22s ease-in both; }

.sdh-wa__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 18px 18px;
  color: #fff;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(37, 211, 102, .45), transparent 55%),
    linear-gradient(135deg, var(--wa-teal), #0a3d36 70%, #062b26);
  overflow: hidden;
}
.sdh-wa__head::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 65%);
  pointer-events: none;
}
.sdh-wa__avatar { position: relative; flex: none; }
.sdh-wa__avatar img { display: block; width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.sdh-wa__avatar i { position: absolute; right: 0; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--wa-green); border: 2px solid var(--wa-teal); }
.sdh-wa__who { min-width: 0; flex: 1; }
.sdh-wa__who h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.25; color: #fff; letter-spacing: -.01em; }
.sdh-wa__who p { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .82); }
.sdh-wa__live { width: 7px; height: 7px; border-radius: 50%; background: var(--wa-green); box-shadow: 0 0 0 0 rgba(37, 211, 102, .7); animation: sdh-wa-live 1.8s infinite; }
.sdh-wa__close { position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); cursor: pointer; transition: background .2s, transform .3s; }
.sdh-wa__close svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.sdh-wa__close:hover, .sdh-wa__close:focus-visible { background: rgba(255, 255, 255, .24); transform: rotate(90deg); outline: none; }

.sdh-wa__chat {
  flex: 1;
  min-height: 210px;
  overflow-y: auto;
  padding: 16px 16px 8px;
  background-color: var(--wa-paper);
  background-image:
    radial-gradient(rgba(7, 94, 84, .07) 1.2px, transparent 1.3px),
    radial-gradient(rgba(7, 94, 84, .05) 1.2px, transparent 1.3px);
  background-size: 22px 22px, 22px 22px;
  background-position: 0 0, 11px 11px;
}
.sdh-wa__day { width: max-content; margin: 0 auto 14px; padding: 4px 12px; border-radius: 8px; background: rgba(255, 255, 255, .85); font-size: 11.5px; font-weight: 600; color: var(--wa-muted); text-transform: uppercase; letter-spacing: .05em; box-shadow: 0 1px 1px rgba(17, 27, 33, .08); }

.sdh-wa__msg, .sdh-wa__typing {
  position: relative;
  max-width: 88%;
  margin-left: 8px;
  border-radius: 0 14px 14px 14px;
  background: var(--wa-bubble);
  box-shadow: 0 1px 1.5px rgba(17, 27, 33, .13);
}
.sdh-wa__msg::before, .sdh-wa__typing::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  border-top: 10px solid var(--wa-bubble);
  border-left: 8px solid transparent;
}
.sdh-wa__msg { padding: 9px 12px 20px; font-size: 14.5px; animation: sdh-wa-msg .45s cubic-bezier(.34, 1.56, .64, 1) both; }
.sdh-wa__msg p { margin: 0 0 6px; }
.sdh-wa__msg p:last-of-type { margin-bottom: 0; }
.sdh-wa__msg time { position: absolute; right: 10px; bottom: 5px; font-size: 11px; color: var(--wa-muted); }
.sdh-wa__typing { display: inline-flex; gap: 4px; padding: 13px 16px; }
.sdh-wa__typing span { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: sdh-wa-dot 1.2s infinite ease-in-out; }
.sdh-wa__typing span:nth-child(2) { animation-delay: .15s; }
.sdh-wa__typing span:nth-child(3) { animation-delay: .3s; }

.sdh-wa__chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.sdh-wa__chips button {
  border: 1px solid rgba(7, 94, 84, .22);
  border-radius: 999px;
  padding: 7px 13px;
  background: rgba(255, 255, 255, .9);
  color: var(--wa-teal);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  animation: sdh-wa-chip .4s cubic-bezier(.34, 1.56, .64, 1) forwards;
  transition: background .2s, color .2s, transform .2s, border-color .2s;
}
.sdh-wa__chips button:nth-child(2) { animation-delay: .07s; }
.sdh-wa__chips button:nth-child(3) { animation-delay: .14s; }
.sdh-wa__chips button:nth-child(4) { animation-delay: .21s; }
.sdh-wa__chips button:hover, .sdh-wa__chips button:focus-visible { background: var(--wa-teal); border-color: var(--wa-teal); color: #fff; transform: translateY(-2px); outline: none; }
.sdh-wa__chips button[aria-pressed="true"] { background: #d9fdd3; border-color: var(--wa-green-deep); color: var(--wa-teal); }

.sdh-wa__compose { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 10px 8px; background: #f0f2f5; }
.sdh-wa__compose textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  padding: 11px 16px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  color: var(--wa-ink);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  box-shadow: 0 1px 1px rgba(17, 27, 33, .08);
}
.sdh-wa__compose textarea:focus { outline: 2px solid var(--wa-green); outline-offset: 0; }
.sdh-wa__send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--wa-green), var(--wa-green-deep));
  cursor: pointer;
  box-shadow: 0 8px 18px -6px rgba(18, 140, 126, .7);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.sdh-wa__send svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }
.sdh-wa__send:hover, .sdh-wa__send:focus-visible { transform: scale(1.1) rotate(-12deg); outline: none; }
.sdh-wa__send:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--wa-teal); }
.sdh-wa__foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 0 12px 12px; background: #f0f2f5; font-size: 11.5px; color: var(--wa-muted); }
.sdh-wa__foot .sdh-wa__glyph { width: 13px; height: 13px; color: var(--wa-green-deep); filter: none; }

/* Keyframes */
@keyframes sdh-wa-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes sdh-wa-ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(1.75); opacity: 0; } }
@keyframes sdh-wa-spin { to { transform: rotate(360deg); } }
@keyframes sdh-wa-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes sdh-wa-rise { from { opacity: 0; transform: translateY(14px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes sdh-wa-open { from { opacity: 0; transform: translateY(24px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes sdh-wa-close { to { opacity: 0; transform: translateY(16px) scale(.85); } }
@keyframes sdh-wa-msg { from { opacity: 0; transform: translateY(8px) scale(.9); transform-origin: top left; } to { opacity: 1; transform: none; } }
@keyframes sdh-wa-chip { from { opacity: 0; transform: translateY(10px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes sdh-wa-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes sdh-wa-live { 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, .7); } 70% { box-shadow: 0 0 0 7px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } }

/* Phones: bottom sheet */
@media (max-width: 520px) {
  .sdh-wa { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .sdh-wa__launcher, .sdh-wa__orb, .sdh-wa__ring { width: 60px; height: 60px; }
  .sdh-wa__orb::after { -webkit-mask: radial-gradient(circle, transparent 28px, #000 29px); mask: radial-gradient(circle, transparent 28px, #000 29px); }
  .sdh-wa__label { display: none; }
  .sdh-wa__teaser { width: min(268px, calc(100vw - 28px)); bottom: 76px; right: 0; }
  .sdh-wa__panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 82vh;
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform-origin: 50% 100%;
  }
  .sdh-wa.is-open .sdh-wa__launcher { opacity: 0; pointer-events: none; }
  .sdh-wa__chat { min-height: 180px; }
  .sdh-wa__compose textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sdh-wa *, .sdh-wa *::before, .sdh-wa *::after { animation: none !important; transition: none !important; }
  .sdh-wa__chips button { opacity: 1; }
  .sdh-wa__ring { display: none; }
}

@media print { .sdh-wa { display: none !important; } }
