.group-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 12px 0 16px;
}

.group-tool-button {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  background: rgba(255,255,255,.045);
  color: inherit;
  font: inherit;
  font-weight: 650;
}

.group-profile-card {
  padding: 22px 16px 120px;
  text-align: center;
}

.group-profile-avatar {
  width: 104px;
  height: 104px;
  margin: 7px auto 14px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.14),
      rgba(255,255,255,.05)
    );
  font-size: 34px;
  font-weight: 750;
}

.group-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-profile-title {
  font-size: 23px;
  line-height: 1.15;
  font-weight: 750;
}

.group-profile-username {
  margin-top: 6px;
  opacity: .62;
  font-size: 15px;
}

.group-profile-description {
  margin: 18px auto 0;
  max-width: 560px;
  padding: 15px;
  border-radius: 15px;
  background: rgba(255,255,255,.045);
  text-align: left;
  white-space: pre-wrap;
  line-height: 1.45;
}

.group-profile-count {
  margin-top: 13px;
  opacity: .72;
}

.group-profile-actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.group-members {
  margin-top: 22px;
  text-align: left;
}

.group-members h3 {
  margin: 0 0 9px;
  font-size: 15px;
  opacity: .75;
}

.group-member {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 0;
  border-bottom:
    1px solid rgba(255,255,255,.065);
}

.group-member-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  font-weight: 700;
}

.group-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-member-main {
  flex: 1;
  min-width: 0;
}

.group-member-name {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-member-username {
  margin-top: 3px;
  opacity: .58;
  font-size: 13px;
}

.group-member-role {
  font-size: 12px;
  opacity: .65;
}

.group-search-result {
  width: 100%;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border: 0;
  border-bottom:
    1px solid rgba(255,255,255,.065);
  background: transparent;
  color: inherit;
  text-align: left;
}

.group-search-result-avatar {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  font-weight: 750;
}

.group-search-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-search-result-main {
  min-width: 0;
  flex: 1;
}

.group-search-result-title {
  font-size: 16px;
  font-weight: 680;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.group-search-result-meta {
  margin-top: 4px;
  font-size: 13px;
  opacity: .62;
}

.group-message-sender {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  opacity: .72;
}

.group-avatar-picker {
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.group-avatar-preview {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  font-size: 30px;
  font-weight: 750;
  cursor: pointer;
}

.group-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-modal-results {
  max-height: 48vh;
  overflow-y: auto;
  margin-top: 12px;
}

/* MARKPAY_GROUP_MESSAGE_AVATAR_TIME_START */

#messages {
  overflow-y: auto;
  padding-bottom: 18px;
}

.standard-message-row {
  width: 100%;
  display: flex;
  margin: 7px 0;
}

.standard-message-row.mine {
  justify-content: flex-end;
}

.standard-message-row.theirs {
  justify-content: flex-start;
}

.group-message-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 9px 0;
}

.group-message-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.09);
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
}

.group-message-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.group-message-content {
  max-width: calc(82% - 44px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.group-message-author {
  max-width: 100%;
  margin: 0 0 4px 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 750;
  opacity: .76;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message {
  position: relative;
  min-width: 74px;
  padding-bottom: 20px !important;
}

.message-text-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-time {
  position: absolute;
  right: 11px;
  bottom: 6px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  opacity: .54;
  pointer-events: none;
}

.message.mine .message-time {
  opacity: .58;
}

.group-member {
  width: 100%;
  cursor: pointer;
}

.group-member:active {
  opacity: .72;
}

.markpay-chat-time {
  position: absolute;
  top: 12px;
  right: 3px;
  font-size: 11px;
  line-height: 1;
  opacity: .5;
  pointer-events: none;
}

#chatsPage .chat-card {
  position: relative !important;
  padding-right: 48px !important;
}

#chatsPage .chat-card .avatar {
  overflow: hidden !important;
}

/* MARKPAY_GROUP_MESSAGE_AVATAR_TIME_END */

/* MARKPAY_OFFICIAL_HELPERS_FIX_START */

.official-badge {
  display: inline-grid;
  place-items: center;

  width: 18px;
  height: 18px;

  margin-left: 5px;
  border-radius: 50%;

  background: #4ea5f5;
  color: #fff;

  font-size: 12px;
  line-height: 1;
  font-weight: 800;

  vertical-align: 2px;
}

.official-chat-label {
  display: none;
}

.avatar img,
.chat-header-avatar img,
.public-profile-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

/* MARKPAY_OFFICIAL_HELPERS_FIX_END */

/* MARKPAY_SUPPORT_LIVE_AVATAR_START */

.markpay-support-live-avatar {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;

  display: grid;
  place-items: center;

  overflow: hidden;
  border-radius: 50%;

  background:
    radial-gradient(
      circle at 34% 26%,
      rgba(255,255,255,.42),
      transparent 18%
    ),
    radial-gradient(
      circle at center,
      #8d68ff 0%,
      #6542ed 48%,
      #3b1ea7 100%
    );

  box-shadow:
    inset 0 0 18px rgba(255,255,255,.2),
    0 0 18px rgba(104,70,255,.42);

  isolation: isolate;
}

.markpay-support-live-avatar::before {
  content: "";

  position: absolute;
  inset: -38%;

  background:
    conic-gradient(
      from 0deg,
      transparent 0deg,
      rgba(255,255,255,.32) 48deg,
      transparent 100deg,
      transparent 210deg,
      rgba(164,135,255,.5) 270deg,
      transparent 330deg
    );

  animation:
    markpaySupportSpin 5.2s linear infinite;

  z-index: 0;
}

.markpay-support-live-avatar::after {
  content: "";

  position: absolute;
  inset: 4px;

  border:
    1px solid rgba(255,255,255,.28);
  border-radius: 50%;

  box-shadow:
    inset 0 0 12px rgba(255,255,255,.12);

  z-index: 1;
}

.markpay-support-live-ring {
  position: absolute;

  border:
    2px solid rgba(255,255,255,.26);
  border-radius: 50%;

  pointer-events: none;
  z-index: 1;
}

.markpay-support-live-ring-one {
  inset: 8%;

  border-top-color:
    rgba(255,255,255,.75);
  border-right-color:
    transparent;

  animation:
    markpaySupportSpin 3.8s linear infinite;
}

.markpay-support-live-ring-two {
  inset: 15%;

  border-bottom-color:
    rgba(194,177,255,.88);
  border-left-color:
    transparent;

  animation:
    markpaySupportSpinReverse
    4.7s linear infinite;
}

.markpay-support-live-core {
  position: relative;

  width: 58%;
  height: 58%;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.26),
      rgba(255,255,255,.07)
    );

  box-shadow:
    0 5px 16px rgba(18,6,74,.34),
    inset 0 1px 1px rgba(255,255,255,.35);

  animation:
    markpaySupportPulse
    2.2s ease-in-out infinite;

  z-index: 2;
}

.markpay-support-headset {
  position: relative;

  width: 62%;
  height: 62%;

  display: block;
}

.markpay-support-arc {
  position: absolute;

  left: 13%;
  top: 10%;

  width: 74%;
  height: 58%;

  border:
    max(2px, .07em) solid #fff;
  border-bottom: 0;
  border-radius:
    50% 50% 0 0;

  box-sizing: border-box;
}

.markpay-support-ear {
  position: absolute;

  top: 49%;

  width: 21%;
  height: 32%;

  border-radius: 45%;

  background: #fff;

  box-shadow:
    0 0 7px rgba(255,255,255,.45);
}

.markpay-support-ear.left {
  left: 5%;
}

.markpay-support-ear.right {
  right: 5%;
}

.markpay-support-mic {
  position: absolute;

  right: 13%;
  bottom: 6%;

  width: 30%;
  height: 9%;

  border-radius: 20px;

  background: #fff;

  transform:
    rotate(-12deg);
  transform-origin: right center;
}

.markpay-support-mic::after {
  content: "";

  position: absolute;

  left: -3px;
  top: 50%;

  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: #fff;

  transform:
    translateY(-50%);
}

@keyframes markpaySupportSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes markpaySupportSpinReverse {
  from {
    transform: rotate(360deg);
  }

  to {
    transform: rotate(0deg);
  }
}

@keyframes markpaySupportPulse {
  0%,
  100% {
    transform: scale(.94);
    filter: brightness(.96);
  }

  50% {
    transform: scale(1.04);
    filter: brightness(1.16);
  }
}

/*
 * В списке, шапке и профиле дочерний
 * живой аватар обязан занимать весь круг.
 */
.avatar > .markpay-support-live-avatar,
.chat-header-avatar >
  .markpay-support-live-avatar,
.public-profile-avatar >
  .markpay-support-live-avatar,
.group-member-avatar >
  .markpay-support-live-avatar,
.group-message-avatar >
  .markpay-support-live-avatar {
  width: 100%;
  height: 100%;
}

/*
 * В большом профиле анимация остаётся
 * той же, только элементы масштабируются.
 */
.public-profile-avatar
  .markpay-support-live-core {
  width: 56%;
  height: 56%;
}

/* MARKPAY_SUPPORT_LIVE_AVATAR_END */

/* MARKPAY_CHAT_MEDIA_START */

.message-upload-status {
  position: fixed;
  left: 50%;
  bottom:
    calc(74px + env(safe-area-inset-bottom));
  z-index: 80;

  width: min(496px, calc(100% - 24px));
  transform: translateX(-50%);

  padding: 9px 13px;
  border-radius: 13px;

  background: rgba(31,31,36,.97);
  border: 1px solid rgba(255,255,255,.1);

  font-size: 13px;
  text-align: center;

  display: none;
}

.message-upload-status.active {
  display: block;
}

.message-input {
  align-items: center;
}

.message-input .message-tool-button {
  width: 44px;
  min-width: 44px;
  height: 48px;
  padding: 0;

  border: 1px solid var(--line);
  border-radius: 16px;

  background: var(--panel);
  color: var(--text);

  font-size: 25px;
  line-height: 1;
  font-weight: 500;
}

.message-input .message-tool-button.voice {
  font-size: 19px;
}

.message-input .message-tool-button.recording {
  background: #ff4b55;
  color: #fff;

  animation:
    markpayVoiceRecording
    1s ease-in-out infinite;
}

.message-input .message-send-button {
  width: 48px;
  min-width: 48px;
}

.message-image {
  display: block;
  width: min(290px, 68vw);
  max-height: 390px;

  overflow: hidden;
  border-radius: 13px;
}

.message-image img {
  display: block;
  width: 100%;
  max-height: 390px;
  object-fit: cover;
}

.message-video {
  display: block;
  width: min(300px, 70vw);
  max-height: 420px;
  border-radius: 13px;
  background: #000;
}

.message-caption {
  margin-top: 8px;
  padding-right: 42px;
  white-space: pre-wrap;
}

.message-audio {
  width: min(285px, 69vw);
  display: flex;
  align-items: center;
  gap: 9px;
}

.message-audio audio {
  min-width: 0;
  width: 240px;
  max-width: 100%;
  height: 38px;
}

.message-audio-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;

  display: grid;
  place-items: center;

  border-radius: 50%;
  background: rgba(255,255,255,.12);

  font-size: 13px;
}

.message.mine .message-audio-icon {
  background: rgba(0,0,0,.1);
}

.message-document {
  width: min(290px, 70vw);
  display: flex;
  align-items: center;
  gap: 11px;

  color: inherit;
  text-decoration: none;
}

.message-document-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;

  display: grid;
  place-items: center;

  border-radius: 13px;
  background: rgba(255,255,255,.11);

  font-size: 21px;
}

.message.mine .message-document-icon {
  background: rgba(0,0,0,.1);
}

.message-document-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.message-document-main strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message-document-main small {
  opacity: .58;
}

@keyframes markpayVoiceRecording {
  0%,
  100% {
    transform: scale(.94);
  }

  50% {
    transform: scale(1.05);
  }
}

/* MARKPAY_CHAT_MEDIA_END */

/* MARKPAY_MEDIA_PREVIEW_V2_START */

.message-tool-button svg,
.message-send-button svg,
.attachment-preview-overlay svg,
.message-audio-icon svg,
.message-document-icon svg {
  width: 23px;
  height: 23px;

  display: block;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-tool-button {
  display: grid !important;
  place-items: center !important;
}

.message-tool-button.attachment svg {
  width: 25px;
  height: 25px;
  transform: rotate(-7deg);
}

.message-tool-button.voice
  .voice-stop-icon {
  display: none;
}

.message-tool-button.voice.recording
  .voice-microphone-icon {
  display: none;
}

.message-tool-button.voice.recording
  .voice-stop-icon {
  display: block;
}

.message-tool-button.voice.recording {
  background: #ff4f5e !important;
  border-color: #ff4f5e !important;
  color: #fff !important;
}

.attachment-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;

  display: flex;
  align-items: flex-end;
  justify-content: center;

  padding:
    20px
    12px
    calc(12px + env(safe-area-inset-bottom));

  background: rgba(0,0,0,.68);
  backdrop-filter: blur(8px);

  opacity: 0;
  transition: opacity .18s ease;
}

.attachment-preview-overlay[hidden] {
  display: none;
}

.attachment-preview-overlay.active {
  opacity: 1;
}

.attachment-preview-sheet {
  width: min(500px, 100%);
  max-height: 90dvh;

  display: flex;
  flex-direction: column;
  gap: 12px;

  overflow-y: auto;

  padding: 14px;

  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;

  background: #18181d;

  box-shadow:
    0 22px 70px rgba(0,0,0,.5);

  transform: translateY(25px);
  transition: transform .2s ease;
}

.attachment-preview-overlay.active
  .attachment-preview-sheet {
  transform: translateY(0);
}

.attachment-preview-header {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
}

.attachment-preview-header strong {
  text-align: center;
  font-size: 16px;
}

.attachment-preview-close {
  width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  padding: 0;
  border: 0;
  border-radius: 13px;

  background: rgba(255,255,255,.07);
  color: #fff;
}

.attachment-preview-close svg {
  width: 21px;
  height: 21px;
}

.attachment-preview-content {
  width: 100%;
  min-height: 210px;
  max-height: 52dvh;

  display: grid;
  place-items: center;

  overflow: hidden;

  border-radius: 18px;
  background: #0b0b0e;
}

.attachment-preview-image,
.attachment-preview-video {
  display: block;

  width: 100%;
  max-height: 52dvh;

  object-fit: contain;
}

.attachment-preview-file {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  padding: 35px 20px;
}

.attachment-preview-file.document {
  flex-direction: column;
}

.attachment-preview-file > svg {
  width: 62px;
  height: 62px;
  opacity: .86;
}

.attachment-preview-file audio {
  width: min(330px, 78vw);
}

.attachment-preview-info {
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 3px;

  padding: 0 3px;
}

.attachment-preview-info strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;

  font-size: 14px;
}

.attachment-preview-info small {
  opacity: .55;
}

#attachmentCaptionInput {
  width: 100%;
  min-height: 54px;
  max-height: 130px;

  resize: none;

  padding: 14px 15px;

  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;

  background: #222228;
  color: #fff;

  font: inherit;
  line-height: 1.3;

  outline: none;
}

#attachmentCaptionInput:focus {
  border-color: rgba(255,255,255,.26);
}

.attachment-preview-send {
  width: 100%;
  min-height: 50px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  border: 0;
  border-radius: 16px;

  background: #fff;
  color: #111;

  font-size: 15px;
  font-weight: 800;
}

.attachment-preview-send svg {
  width: 20px;
  height: 20px;
}

.attachment-preview-send:disabled {
  opacity: .55;
}

.message-image {
  margin: -6px -8px 0;
}

.message-image img {
  min-height: 90px;
}

.message-caption {
  margin-top: 9px;
  padding-right: 42px;
}

.message-audio-icon {
  display: grid;
  place-items: center;
}

.message-audio-icon svg {
  width: 18px;
  height: 18px;
}

.message-document-icon {
  display: grid;
  place-items: center;
}

.message-document-icon svg {
  width: 23px;
  height: 23px;
}

/* MARKPAY_MEDIA_PREVIEW_V2_END */
