/* Плавающая поддержка в кабинете */
.support-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, #2d7ff9, #1a5fd0);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 8px 28px rgba(26, 95, 208, 0.45);
  cursor: pointer;
}

.support-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ff4d4f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.support-panel {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 8999;
  width: min(380px, calc(100vw - 24px));
  max-height: min(680px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  background: #10151c;
  border: 1px solid #243041;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.support-panel[hidden] {
  display: none !important;
}

.support-panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid #243041;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.support-panel-head strong {
  font-size: 15px;
}

.support-panel-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #8fa3b8;
}

.support-close {
  border: none;
  background: transparent;
  color: #8fa3b8;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.support-messages {
  flex: 1;
  min-height: 280px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 641px) {
  .support-panel {
    height: min(680px, calc(100vh - 100px));
  }

  .support-messages {
    min-height: 420px;
  }
}

.support-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.support-msg.client {
  align-self: flex-end;
  background: #1a5fd0;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.support-msg.admin {
  align-self: flex-start;
  background: #1c2430;
  color: #e8eef6;
  border-bottom-left-radius: 4px;
}

.support-msg time {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.7;
}

.support-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #243041;
}

.support-form textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid #243041;
  border-radius: 10px;
  background: #0a0e14;
  color: #e8eef6;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

.support-attach {
  border: 1px solid #243041;
  background: #0a0e14;
  border-radius: 10px;
  padding: 0 10px;
  cursor: pointer;
}

.support-typing {
  padding: 6px 14px;
  font-size: 12px;
  color: #8fa3b8;
  font-style: italic;
}

.support-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #162033;
  border-top: 1px solid #243041;
  font-size: 12px;
  color: #8fa3b8;
}

.support-reply-bar button {
  border: none;
  background: transparent;
  color: #8fa3b8;
  font-size: 18px;
  cursor: pointer;
}

.support-reply-quote {
  font-size: 12px;
  opacity: 0.85;
  border-left: 3px solid rgba(255, 255, 255, 0.25);
  padding-left: 8px;
  margin-bottom: 6px;
}

.support-reply-label {
  display: block;
  font-weight: 600;
  font-size: 11px;
  margin-bottom: 2px;
}

.support-img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: zoom-in;
}

.support-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.75;
}

.support-read {
  letter-spacing: -1px;
}

.support-ctx-menu {
  position: fixed;
  z-index: 10000;
  background: #1c2430;
  border: 1px solid #243041;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.support-ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e8eef6;
  padding: 10px 14px;
  cursor: pointer;
}

.support-ctx-menu button:hover {
  background: #243041;
}

.support-hint {
  padding: 0 12px 10px;
  font-size: 11px;
  color: #6d8299;
}

.support-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8998;
  background: rgba(0, 0, 0, 0.55);
}

.support-backdrop[hidden] {
  display: none !important;
}

body.support-panel-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .support-fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
  }

  .support-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: none;
    height: min(92vh, 100%);
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .support-panel-head {
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }

  .support-hint {
    font-size: 12px;
    line-height: 1.35;
  }
}
