.message-bubble {
  position: relative;
}

.pw-msg-actions-toggle {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255,255,255,.94);
  color: #475569;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .12s ease, transform .12s ease;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(15,23,42,.14);
  pointer-events: auto;
  touch-action: manipulation;
}

.pw-msg-actions-icon {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 17px;
  line-height: 1;
}

.message-row.out .pw-msg-actions-toggle {
  background: rgba(240,253,244,.96);
}

.message-bubble:hover .pw-msg-actions-toggle,
.pw-msg-actions-toggle:focus,
.pw-msg-actions-toggle:focus-visible {
  opacity: 1;
  transform: none;
}

.pw-msg-menu {
  position: fixed;
  z-index: 2147483000;
  width: 210px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 10px;
  background: #fff;
  color: #111827;
  box-shadow: 0 14px 38px rgba(15,23,42,.28);
  pointer-events: auto;
}

.pw-msg-menu-loading,
.pw-msg-menu-error {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 10px;
  font-size: 13px;
}

.pw-msg-menu-error {
  flex-direction: column;
  align-items: flex-start;
  color: #991b1b;
}

.pw-msg-menu-error span {
  color: #475569;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.pw-msg-menu-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid #cbd5e1;
  border-top-color: #475569;
  border-radius: 50%;
  animation: pwActionSpin .7s linear infinite;
}

@keyframes pwActionSpin {
  to { transform: rotate(360deg); }
}

.pw-msg-menu-separator {
  height: 1px;
  margin: 5px 3px;
  background: #e5e7eb;
}

.pw-msg-menu-item {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 7px;
  padding: 9px 10px;
  background: transparent;
  color: #111827;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.pw-msg-menu-item:hover:not(:disabled),
.pw-msg-menu-item:focus-visible:not(:disabled) {
  background: #f1f5f9;
}

.pw-msg-menu-item.danger {
  color: #b91c1c;
}

.pw-msg-menu-item:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.pw-action-notice {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2147483640;
  max-width: min(520px, calc(100vw - 24px));
  padding: 10px 14px;
  border-radius: 9px;
  background: #991b1b;
  color: #fff;
  box-shadow: 0 8px 25px rgba(15,23,42,.3);
  font-size: 13px;
}

.pw-action-notice.success {
  background: #166534;
}

[data-native-pin],
[data-group-pin] {
  display: none !important;
}

@media (max-width: 900px) {
  .pw-msg-actions-toggle {
    opacity: .82;
    transform: none;
  }

  .pw-msg-menu {
    width: min(230px, calc(100vw - 16px));
  }
}
/* PW_WA_WEB_MOBILE_REPLY_UX_R1 */

/* WhatsApp Web-like: chevron appears only on hover/focus. */
@media (hover: hover) and (pointer: fine) and (min-width: 901px) {
  .message-row .pw-msg-actions-toggle {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition:
      opacity 120ms ease,
      visibility 120ms ease !important;
  }

  .message-row:hover .pw-msg-actions-toggle,
  .message-row:focus-within .pw-msg-actions-toggle,
  .pw-msg-actions-toggle:focus-visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .pw-msg-actions-toggle {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    border: 0 !important;
    box-shadow: none !important;
    cursor: pointer !important;
  }

  .pw-msg-actions-icon {
    font-size: 15px !important;
    line-height: 1 !important;
  }

  .pw-wa-swipe-reply-indicator {
    display: none !important;
  }
}

/* WhatsApp mobile-like: swipe right on the message to reply. */
@media (hover: none), (pointer: coarse), (max-width: 900px) {
  .pw-msg-actions-toggle,
  .pw-msg-menu {
    display: none !important;
  }

  .message-row[data-message-id] .message-bubble {
    touch-action: pan-y pinch-zoom;
    will-change: transform;
  }

  .message-row[data-message-id] {
    position: relative;
  }

  .pw-wa-swipe-reply-indicator {
    position: absolute;
    left: 10px;
    top: 50%;
    width: 34px;
    height: 34px;
    margin-top: -17px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(.78);
    pointer-events: none;
    z-index: 1;
    background: rgba(0,0,0,.10);
    transition:
      opacity 90ms ease,
      transform 90ms ease;
  }

  .pw-wa-swipe-reply-indicator svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }

  .message-row.pw-wa-swipe-active
  .pw-wa-swipe-reply-indicator {
    opacity: .72;
    transform: scale(.92);
  }

  .message-row.pw-wa-swipe-ready
  .pw-wa-swipe-reply-indicator {
    opacity: 1;
    transform: scale(1);
  }
}