.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Виджет поддержки (helpdesk) */
.pm-helpdesk {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10050;
  font-family: "Inter", Arial, sans-serif;
}

.pm-helpdesk-fab {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #7b6cff 0%, #5f86ff 100%);
  color: #fff;
  box-shadow:
    0 0 0 6px rgba(123, 108, 255, 0.22),
    0 12px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pm-helpdesk-fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 8px rgba(123, 108, 255, 0.28),
    0 16px 32px rgba(0, 0, 0, 0.4);
}

.pm-helpdesk-fab svg {
  width: 28px;
  height: 28px;
}

.pm-helpdesk-fab[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}

.pm-helpdesk-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  color: #1a2340;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  transform-origin: bottom right;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.pm-helpdesk-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

.pm-helpdesk-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #7b6cff 0%, #6a5ce8 100%);
  color: #fff;
}

.pm-helpdesk-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.pm-helpdesk-head-text {
  flex: 1;
  min-width: 0;
}

.pm-helpdesk-head-text strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.25;
}

.pm-helpdesk-head-text span {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  opacity: 0.92;
}

.pm-helpdesk-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.pm-helpdesk-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.pm-helpdesk-body {
  flex: 1;
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: #f6f8fc;
}

.pm-helpdesk-panel.is-chat-mode .pm-helpdesk-body {
  min-height: 200px;
  max-height: 340px;
}

.pm-helpdesk-msg {
  max-width: 88%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.pm-helpdesk-msg--bot {
  margin-right: auto;
  background: #fff;
  border: 1px solid #e2e8f5;
  color: #1a2340;
}

.pm-helpdesk-msg--user {
  margin-left: auto;
  background: #e8eeff;
  color: #1a2340;
}

.pm-helpdesk-intro {
  padding: 12px 14px 0;
  background: #f6f8fc;
  display: grid;
  gap: 10px;
}

.pm-helpdesk-intro[hidden],
.pm-helpdesk-intro.is-hidden {
  display: none !important;
}

.pm-helpdesk-panel.is-chat-mode .pm-helpdesk-intro {
  display: none !important;
}

.pm-helpdesk-intro label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  color: #4a5678;
}

.pm-helpdesk-intro input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d5ddf0;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #1a2340;
  background: #fff;
}

.pm-helpdesk-intro input.pm-helpdesk-input--invalid {
  border-color: #e07070;
  background: #fff8f8;
}

.pm-helpdesk-field-hint {
  font-size: 0.72rem;
  line-height: 1.35;
  color: #c44;
}

.pm-helpdesk-field-hint[hidden] {
  display: none !important;
}

.pm-helpdesk-intro-hint {
  margin: 0;
  font-size: 0.75rem;
  color: #6b7899;
  line-height: 1.4;
}

.pm-helpdesk-intro .btn {
  margin-top: 4px;
  width: 100%;
  justify-content: center;
}

.pm-helpdesk-foot {
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid #e8edf8;
}

.pm-helpdesk-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.pm-helpdesk-compose textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #d5ddf0;
  border-radius: 22px;
  font-size: 0.88rem;
  font-family: inherit;
  color: #1a2340;
  background: #f9fafc;
}

.pm-helpdesk-compose textarea:focus {
  outline: 2px solid rgba(95, 134, 255, 0.45);
  border-color: #7b6cff;
}

.pm-helpdesk-send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  background: linear-gradient(145deg, #7b6cff, #5f86ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-helpdesk-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pm-helpdesk-send svg {
  width: 20px;
  height: 20px;
}

.pm-helpdesk-status {
  margin: 8px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #c44;
  min-height: 1em;
}

.pm-helpdesk-status.is-ok {
  color: #2d8a4e;
}

.pm-helpdesk-brand {
  margin: 6px 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: #9aa5bf;
}

.pm-helpdesk-captcha-host {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.pm-helpdesk-panel.is-busy .pm-helpdesk-compose textarea,
.pm-helpdesk-panel.is-busy .pm-helpdesk-send {
  opacity: 0.65;
  pointer-events: none;
}

@media (max-width: 480px) {
  .pm-helpdesk {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .pm-helpdesk-panel {
    width: 100%;
    right: 0;
    left: 0;
  }
}
