#pp-wa {
  --pp-green: #25D366;
  --pp-ink: #0f172a;
  --pp-mute: #64748b;
  --pp-badge-bg: #e8f9ef;
  --pp-badge-color: #128C4B;
  --pp-dot-bg: #ef4444;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
}
#pp-wa * {
  box-sizing: border-box;
}
.pp-wa-bubble {
  position: relative;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--pp-green);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  transition: transform .2s;
  padding: 0;
}
.pp-wa-bubble:hover {
  transform: scale(1.07);
}
.pp-wa-tip {
  position: absolute;
  right: 68px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: #fff;
  color: var(--pp-ink);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
#pp-wa.open .pp-wa-tip {
  display: none;
}
.pp-wa-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: #fff;
  color: var(--pp-ink);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  padding: 20px 18px 18px;
}
.pp-wa-panel[hidden] {
  display: none !important;
}
#pp-wa.open .pp-wa-panel {
  display: block;
}
.pp-wa-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: var(--pp-mute);
  cursor: pointer;
  padding: 4px;
}
.pp-wa-badge {
  display: inline-block;
  background: var(--pp-badge-bg);
  color: var(--pp-badge-color);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.pp-wa-head h3 {
  margin: 8px 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--pp-ink);
}
.pp-wa-head p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--pp-mute);
  line-height: 1.45;
}
#pp-wa-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--pp-ink);
}
#pp-wa-form input,
#pp-wa-form select,
#pp-wa-form textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 11px;
  font: inherit;
  height: fit-content;
  font-size: 14px;
  font-weight: 400;
  color: var(--pp-ink);
  border: 1px solid #d6dce4;
  border-radius: 10px;
  background: #fff;
}
#pp-wa-form input:focus,
#pp-wa-form select:focus,
#pp-wa-form textarea:focus {
  outline: 2px solid var(--pp-green);
  outline-offset: 0;
  border-color: transparent;
}
.pp-wa-err {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: #dc2626;
}
.pp-wa-err[hidden] {
  display: none;
}
.pp-wa-submit {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--pp-green);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.pp-wa-submit:hover {
  filter: brightness(.95);
}
.pp-wa-dot {
  display: none;
}
.pp-wa-backdrop {
  display: none;
}
@media (max-width: 600px) {
  #pp-wa {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .pp-wa-bubble {
    width: 54px;
    height: 54px;
  }
  .pp-wa-tip {
    display: none;
  }
  /* nhãn $80 nhỏ gắn trên nút thay cho tooltip */
  .pp-wa-dot {
    display: block;
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--pp-dot-bg);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    border: 2px solid #fff;
    line-height: 1.2;
  }
  #pp-wa.open .pp-wa-dot {
    display: none;
  }
  /* nền mờ phía sau */
  .pp-wa-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: -1;
  }
  #pp-wa.open .pp-wa-backdrop {
    display: block;
  }
  /* form thành bottom sheet full chiều ngang */
  .pp-wa-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
    animation: ppUp .25s ease-out;
  }
  .pp-wa-panel::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: #d6dce4;
    margin: -10px auto 14px;
  }
  .pp-wa-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 28px;
  }
  .pp-wa-head h3 {
    font-size: 20px;
  }
  .pp-wa-head p {
    font-size: 14px;
  }
  #pp-wa-form label {
    font-size: 14px;
    margin-bottom: 12px;
  }
  /* 16px để iPhone không tự zoom khi bấm vào ô */
  #pp-wa-form input,
  #pp-wa-form select,
  #pp-wa-form textarea {
    font-size: 16px;
    padding: 13px 12px;
  }
  .pp-wa-submit {
    padding: 15px;
    font-size: 16px;
  }
  #pp-wa.open .pp-wa-bubble {
    display: none;
  }
}
@keyframes ppUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pp-wa-panel {
    animation: none;
  }
}
