/* ==========================================================================
   IngLegacy — site fix layer
   Loaded after site-update.css. Fixed right chat, new indicators, attachments.
   ========================================================================== */

:root {
  --chat-w: clamp(320px, 26vw, 400px);
  --chat-head-h: var(--rl-nav-h, 68px);
  --fix-line: var(--transparent-10-w, rgba(255, 255, 255, 0.1));
  --fix-line-strong: var(--transparent-20-w, rgba(255, 255, 255, 0.2));
  --fix-muted: var(--text-secondary, #838383);
  --fix-text: var(--text-default, #fff);
  --fix-card: var(--card, #171717);
  --fix-bg: var(--bg, #111);
  --fix-accent: var(--span, #7e9dff);
  --fix-accent-soft: var(--span-10, rgba(126, 157, 255, 0.1));
  --fix-admin: var(--red, #ff4940);
  --fix-green: var(--green, #64ce82);
}

/* --------------------------------------------------------------------------
   Desktop shell: content left, chat right
   -------------------------------------------------------------------------- */

@media (min-width: 1100px) {
  body {
    padding-right: 0;
    overflow-x: clip;
    transition: padding-right 0.22s ease;
  }

  html.chat-open body {
    padding-right: var(--chat-w);
  }

  .global-container,
  .container-fluid {
    min-width: 0;
    max-width: 100%;
  }

  .container-fluid {
    max-width: 1680px;
    padding-inline: clamp(16px, 1.4vw, 24px);
  }

  .site-chat {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 1000;
    width: var(--chat-w);
    max-width: 100vw;
    pointer-events: none;
    font-family: var(--su-font-body, var(--font-family-2), sans-serif);
  }

  .site-chat .site-chat__panel {
    position: absolute;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    overflow: hidden;
    border: 0;
    border-left: 1px solid var(--fix-line);
    border-radius: 0;
    background: var(--fix-card);
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s ease;
  }

  html.chat-open .site-chat .site-chat__panel,
  .site-chat.is-open .site-chat__panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }

  .site-chat .site-chat__fab {
    display: inline-flex;
  }

  html.chat-open .site-chat .site-chat__fab,
  .site-chat.is-open .site-chat__fab {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .site-chat .site-chat__back {
    display: none !important;
  }

  .site-chat .site-chat__head {
    height: var(--chat-head-h);
    min-height: var(--chat-head-h);
  }

  .site-chat .site-chat__messages {
    padding: 10px 14px 14px;
  }

  /* modals, popups, toasts must not hide under the open chat */
  html.chat-open .modal-window,
  html.chat-open .popup_modal,
  html.chat-open .modal,
  html.chat-open .modal-window-server,
  html.chat-open .site-lightbox {
    right: var(--chat-w);
    width: auto;
  }

  html.chat-open .modal-window {
    max-width: calc(100vw - var(--chat-w));
  }

  html.chat-open .theme__sidebar {
    right: var(--chat-w);
  }

  html.chat-open .iziToast-container {
    right: calc(var(--chat-w) + 18px) !important;
    max-width: min(420px, calc(100vw - var(--chat-w) - 36px)) !important;
  }

  html.chat-open .modal_users_container {
    max-width: calc(100vw - var(--chat-w) - 30px);
  }

  html.chat-open .site-lightbox img {
    max-width: calc(100vw - var(--chat-w) - 48px);
  }

  html.chat-open .nav_header_menu {
    right: var(--chat-w);
  }

  .container-fluid .row > [class*="col-md-3"],
  .container-fluid .row > [class*="col-md-9"] {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }
}

@media (min-width: 1100px) and (max-width: 1399px) {
  .skinchanger {
    flex-direction: column;
  }

  .skinchanger .sc__aside {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
  }

  .skinchanger .sc__content {
    min-width: 0;
  }
}

@media (min-width: 1280px) {
  .container-fluid .row > [class*="col-md-3"] {
    flex: 0 0 25%;
    width: 25%;
    max-width: 25%;
  }

  .container-fluid .row > [class*="col-md-9"] {
    flex: 0 0 75%;
    width: 75%;
    max-width: 75%;
  }
}

/* Tablet/phone chat: full-screen layer, no fixed sidebar */
@media (max-width: 1099px) {
  .site-chat {
    position: fixed;
    inset: 0;
    z-index: 1200;
    width: auto;
    pointer-events: none;
  }

  .site-chat .site-chat__fab {
    position: fixed;
    right: 20px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    display: inline-flex;
    pointer-events: auto;
  }

  .site-chat .site-chat__panel {
    position: fixed;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--fix-card);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: none;
  }

  .site-chat.is-mobile-open .site-chat__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-chat.is-mobile-open .site-chat__fab {
    display: none;
  }

  .site-chat .site-chat__head {
    height: calc(58px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  .site-chat .site-chat__composer {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  body:has(.site-chat.is-mobile-open) {
    overflow: hidden;
  }
}

/* --------------------------------------------------------------------------
   Chat panel
   -------------------------------------------------------------------------- */

.site-chat .site-chat__fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--fix-accent) 38%, transparent);
  border-radius: 18px;
  background: var(--fix-accent);
  background: linear-gradient(145deg,
      color-mix(in srgb, var(--fix-accent) 88%, var(--text-default, #fff) 12%),
      color-mix(in srgb, var(--fix-accent) 80%, var(--fix-bg) 20%));
  color: var(--text-default, #fff);
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    0 16px 38px color-mix(in srgb, var(--fix-accent) 28%, transparent),
    0 6px 16px var(--transparent-20-b, rgba(0, 0, 0, 0.18));
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.site-chat .site-chat__fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 20px 46px color-mix(in srgb, var(--fix-accent) 38%, transparent),
    0 8px 20px var(--transparent-20-b, rgba(0, 0, 0, 0.2));
}

.site-chat .site-chat__fab:active {
  transform: translateY(0) scale(0.97);
}

.site-chat .site-chat__fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  color: currentColor;
}

.site-chat .site-chat__fab-icon svg {
  width: 100%;
  height: 100%;
}

.site-chat .site-chat__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border: 2px solid var(--fix-bg);
  border-radius: 999px;
  background: var(--fix-admin);
  color: var(--text-default, #fff);
  font-family: var(--su-font-body, var(--font-family-2), sans-serif);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  animation: fab-badge-in 0.18s ease;
}

.site-chat .site-chat__badge[hidden] {
  display: none !important;
}

.site-chat .site-chat__fab.is-pulse {
  animation: fab-pulse 0.55s ease;
}

@keyframes fab-badge-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fab-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.08); }
  70% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

.site-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  padding: 0 14px;
  border-bottom: 1px solid var(--fix-line);
  background: var(--fix-card);
}

.site-chat__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-chat__brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--fix-accent-soft);
  color: var(--fix-accent);
}

.site-chat__brand-icon svg {
  width: 19px;
  height: 19px;
}

.site-chat__title {
  color: var(--fix-text);
  font-family: var(--su-font-display, var(--font-family-1), sans-serif);
  font-size: 15px;
  font-weight: 600;
}

.site-chat__head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-chat__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fix-muted);
  cursor: pointer;
  transition: background var(--su-ease, 0.2s), color var(--su-ease, 0.2s);
}

.site-chat__icon-btn:hover,
.site-chat__icon-btn:focus-visible {
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
  color: var(--fix-text);
}

.site-chat__icon-btn svg,
.site-chat__send svg {
  width: 18px;
  height: 18px;
}

.sound-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
}

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

[data-sound-toggle][aria-pressed="true"] .sound-off,
[data-sound-toggle][aria-pressed="false"] .sound-on {
  display: none;
}

.site-chat__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.site-chat__empty {
  padding: 40px 16px;
  color: var(--fix-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.site-chat__msg {
  position: relative;
  padding: 9px 6px 10px;
  border-bottom: 1px solid var(--transparent-5-w, rgba(255, 255, 255, 0.05));
  border-radius: 9px;
  transition: background var(--su-ease, 0.2s);
}

.site-chat__msg.is-mine {
  background: var(--span-low, rgba(126, 157, 255, 0.05));
}

.site-chat__msg.is-highlighted {
  background: var(--fix-accent-soft);
  box-shadow: 0 0 0 5px var(--fix-accent-soft);
}

.site-chat__msg-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 3px;
}

.site-chat__msg-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
}

.site-chat__msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-chat__msg-name {
  color: var(--fix-text);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.site-chat__msg-name.is-admin {
  color: var(--fix-admin);
}

.site-chat__msg-name:hover {
  text-decoration: underline;
}

.site-chat__msg-time,
.site-chat__msg-edited {
  color: var(--fix-muted);
  font-size: 10px;
}

.site-chat__msg-edited {
  font-style: italic;
}

.site-chat__msg-body {
  color: var(--fix-text);
  font-size: 13px;
  line-height: 1.48;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.site-chat__msg-body.is-deleted {
  color: var(--fix-muted);
  font-style: italic;
}

.site-chat__msg.is-pending {
  opacity: 0.72;
}

.site-chat__msg.is-failed {
  background: color-mix(in srgb, var(--fix-admin) 8%, transparent);
}

.site-chat__msg-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--fix-muted);
  font-size: 10px;
}

.site-chat__msg.is-failed .site-chat__msg-status {
  color: var(--fix-admin);
}

.site-chat__retry {
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--fix-line);
  border-radius: 6px;
  background: transparent;
  color: var(--fix-text);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.site-chat__retry:hover {
  border-color: var(--fix-accent);
  color: var(--fix-accent);
}

.site-chat__quote {
  display: block;
  width: 100%;
  margin: 5px 0 6px;
  padding: 6px 9px;
  border: 0;
  border-left: 2px solid var(--fix-accent);
  border-radius: 0 7px 7px 0;
  background: var(--fix-accent-soft);
  color: var(--fix-muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.site-chat__quote b {
  display: block;
  margin-bottom: 2px;
  color: var(--fix-text);
  font-size: 11px;
}

.site-chat__quote span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-chat__msg-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--fix-line);
  border-radius: 8px;
  background: var(--fix-card);
  box-shadow: 0 6px 18px var(--transparent-20-b, rgba(0, 0, 0, 0.15));
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--su-ease, 0.2s), visibility var(--su-ease, 0.2s);
}

.site-chat__msg:hover .site-chat__msg-actions,
.site-chat__msg:focus-within .site-chat__msg-actions {
  opacity: 1;
  visibility: visible;
}

.site-chat__msg-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fix-muted);
  cursor: pointer;
}

.site-chat__msg-action svg {
  width: 14px;
  height: 14px;
}

.site-chat__msg-action:hover,
.site-chat__msg-action:focus-visible {
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
  color: var(--fix-text);
}

.site-chat__msg-action--danger:hover {
  color: var(--fix-admin);
}

.site-chat__media {
  display: block;
  width: min(230px, 100%);
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid var(--fix-line);
  border-radius: 9px;
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
}

.site-chat__media img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.site-chat__edit {
  width: 100%;
  min-height: 54px;
  margin-top: 4px;
  padding: 8px 10px;
  resize: vertical;
  border: 1px solid var(--fix-line-strong);
  border-radius: 8px;
  background: var(--input-form, #1e1e1e);
  color: var(--fix-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.site-chat__edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.site-chat__edit-save,
.site-chat__edit-cancel {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--fix-line);
  border-radius: 7px;
  background: var(--button, #232323);
  color: var(--fix-text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.site-chat__edit-save {
  border-color: transparent;
  background: var(--fix-accent);
  color: var(--text-default, #fff);
}

.site-chat__reply {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 7px 12px;
  border-top: 1px solid var(--fix-line);
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
}

.site-chat__reply[hidden] {
  display: none !important;
}

.site-chat__reply-text {
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--fix-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  padding: 9px 10px;
  border-top: 1px solid var(--fix-line);
  background: var(--fix-card);
}

.site-chat__composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  max-height: 96px;
  padding: 9px 10px;
  resize: none;
  border: 1px solid var(--fix-line);
  border-radius: 10px;
  background: var(--input-form, #1e1e1e);
  color: var(--fix-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
}

.site-chat__composer textarea:focus {
  border-color: var(--fix-accent);
  outline: none;
}

.site-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--fix-accent);
  color: var(--text-default, #fff);
  cursor: pointer;
}

.site-chat__send:hover {
  filter: brightness(0.92);
}

.site-chat__send:disabled {
  opacity: 0.5;
  cursor: default;
}

.site-chat__guest {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  padding: 12px 14px;
  border-top: 1px solid var(--fix-line);
  color: var(--fix-muted);
  font-size: 11px;
}

.site-chat__guest .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border-radius: 9px;
  background: var(--fix-accent);
  color: var(--text-default, #fff);
  font-size: 13px;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Attachments (chat + messenger)
   -------------------------------------------------------------------------- */

.attach {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.attach__bar {
  display: flex;
  align-items: center;
  gap: 1px;
}

.attach__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fix-muted);
  cursor: pointer;
  transition: background var(--su-ease, 0.2s), color var(--su-ease, 0.2s);
}

.attach__btn svg {
  width: 18px;
  height: 18px;
}

.attach__btn:hover,
.attach__btn:focus-visible {
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
  color: var(--fix-text);
}

.attach__menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: 150px;
  padding: 5px;
  border: 1px solid var(--fix-line);
  border-radius: 10px;
  background: var(--fix-card);
  box-shadow: 0 16px 40px var(--transparent-20-b, rgba(0, 0, 0, 0.2));
}

.attach__menu[hidden] {
  display: none !important;
}

.attach__menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fix-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.attach__menu-item svg {
  width: 17px;
  height: 17px;
  color: var(--fix-muted);
}

.attach__menu-item:hover,
.attach__menu-item:focus-visible {
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
}

.attach__panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 35;
  width: min(340px, calc(var(--chat-w, 360px) - 24px));
  max-height: min(430px, 58vh);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--fix-line);
  border-radius: 11px;
  background: var(--fix-card);
  box-shadow: 0 18px 46px var(--transparent-20-b, rgba(0, 0, 0, 0.22));
  scrollbar-width: thin;
}

.attach__panel[hidden] {
  display: none !important;
}

.attach__tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--fix-line);
}

.attach__tab {
  flex: 1 1 auto;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fix-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.attach__tab.is-active,
.attach__tab:hover {
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
  color: var(--fix-text);
}

.attach__gif-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attach__input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--fix-line);
  border-radius: 8px;
  background: var(--input-form, #1e1e1e);
  color: var(--fix-text);
  font-size: 12px;
}

.attach__gif-search {
  display: flex;
  gap: 6px;
}

.attach__gif-search .attach__input {
  flex: 1 1 auto;
}

.attach__gif-search .button {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 10px;
  font-size: 11px;
}

.attach__gif-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.attach__gif-item {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--fix-line);
  border-radius: 7px;
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
  cursor: pointer;
}

.attach__gif-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attach__gif-item:hover,
.attach__gif-item:focus-visible {
  border-color: var(--fix-accent);
}

.attach__powered {
  padding-top: 5px;
  color: var(--fix-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: right;
}

.attach__hint {
  color: var(--fix-muted);
  font-size: 10px;
  line-height: 1.45;
}

.attach__emoji-row + .attach__emoji-row {
  margin-top: 9px;
}

.attach__emoji-title {
  margin-bottom: 4px;
  color: var(--fix-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.attach__emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
  gap: 1px;
}

.attach__emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.attach__emoji:hover,
.attach__emoji:focus-visible {
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
}

.attach-preview-bar {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-top: 1px solid var(--fix-line);
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
}

.attach-preview-bar[hidden] {
  display: none !important;
}

.attach-preview-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--fix-line);
  border-radius: 8px;
  background: var(--fix-card);
  color: var(--fix-text);
  font-size: 11px;
}

.attach-preview-chip img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.attach-preview-chip span {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-preview-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fix-muted);
  cursor: pointer;
}

.attach-preview-remove svg {
  width: 14px;
  height: 14px;
}

.attach-preview-remove:hover {
  color: var(--fix-admin);
}

/* --------------------------------------------------------------------------
   Site online pills
   -------------------------------------------------------------------------- */

.site-online {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: 4px;
}

.online-pill-wrap {
  position: relative;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--fix-line);
  border-radius: 999px;
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
  color: var(--fix-text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--su-ease, 0.2s), background var(--su-ease, 0.2s), opacity var(--su-ease, 0.2s);
}

.online-pill:hover,
.online-pill:focus-visible,
.online-pill[aria-expanded="true"] {
  border-color: var(--fix-line-strong);
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
}

.online-pill.is-empty {
  opacity: 0.55;
}

.online-pill__icon {
  display: inline-flex;
  color: var(--fix-muted);
}

.online-pill--admins .online-pill__icon {
  color: var(--fix-admin);
}

.online-pill--users .online-pill__icon {
  color: var(--fix-green);
}

.online-pill__icon svg {
  width: 16px;
  height: 16px;
}

.online-pill__count {
  color: var(--fix-text);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.online-pill__avatars {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.online-pill.is-empty .online-pill__avatars {
  display: none;
}

.online-avatar {
  display: inline-flex;
  width: 21px;
  height: 21px;
  margin-left: -6px;
  overflow: hidden;
  border: 2px solid var(--fix-card);
  border-radius: 50%;
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
}

.online-avatar:first-child {
  margin-left: 0;
}

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

.online-pill.is-bumped,
.online-mobile-row.is-bumped {
  animation: online-bump 0.35s ease;
}

@keyframes online-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

.online-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 700;
  width: 280px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--fix-line);
  border-radius: 12px;
  background: var(--fix-card);
  box-shadow: 0 20px 50px var(--transparent-20-b, rgba(0, 0, 0, 0.3));
  scrollbar-width: thin;
}

.online-pop[hidden] {
  display: none !important;
}

.online-pop__head {
  padding: 4px 6px 7px;
  color: var(--fix-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.online-pop__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.online-pop__item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px;
  border-radius: 8px;
  color: var(--fix-text);
  text-decoration: none;
}

.online-pop__item:hover,
.online-pop__item:focus-visible {
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
}

.online-pop__item img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--transparent-5-w, rgba(255, 255, 255, 0.05));
}

.online-pop__item > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.online-pop__name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-pop__name.is-admin {
  color: var(--fix-admin);
}

.online-pop__id {
  color: var(--fix-muted);
  font-size: 10px;
}

.online-pop__empty {
  padding: 12px 6px;
  color: var(--fix-muted);
  font-size: 11px;
  text-align: center;
}

.online-pop__more {
  padding: 7px 6px 2px;
  color: var(--fix-muted);
  font-size: 10px;
}

.site-online-mobile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 20px 8px;
}

.online-mobile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 9px;
  border: 1px solid var(--fix-line);
  border-radius: 10px;
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
}

.online-mobile-row__icon {
  display: inline-flex;
  color: var(--fix-muted);
}

.online-mobile-row[data-online-mobile="admins"] .online-mobile-row__icon {
  color: var(--fix-admin);
}

.online-mobile-row[data-online-mobile="users"] .online-mobile-row__icon {
  color: var(--fix-green);
}

.online-mobile-row__icon svg {
  width: 17px;
  height: 17px;
}

.online-mobile-row__label {
  flex: 1 1 auto;
  color: var(--fix-text);
  font-size: 12px;
  font-weight: 600;
}

.online-mobile-row__avatars {
  display: inline-flex;
  align-items: center;
}

.online-mobile-row__count {
  color: var(--fix-text);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1099px) {
  .site-online--desktop {
    display: none;
  }

  .site-online-mobile {
    display: flex;
  }
}

@media (min-width: 1100px) {
  .site-online-mobile {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Messenger adjustments
   -------------------------------------------------------------------------- */

.messenger {
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
}

.messenger__composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.messenger__composer textarea {
  min-height: 38px;
  max-height: 120px;
}

.messenger__composer > button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  background: var(--fix-accent);
  color: var(--text-default, #fff);
}

.messenger__composer > button[type="submit"] svg {
  width: 17px;
  height: 17px;
}

.messenger__delete {
  width: 22px;
  height: 22px;
  opacity: 0;
}

.messenger__delete svg {
  width: 13px;
  height: 13px;
}

.messenger__back svg {
  width: 18px;
  height: 18px;
}

.messenger__message:hover .messenger__delete,
.messenger__message:focus-within .messenger__delete {
  opacity: 1;
}

.messenger__media {
  border-radius: 9px;
}

@media (max-width: 1023px) {
  .messenger {
    grid-template-columns: 1fr;
    height: calc(100dvh - 140px);
  }
}

/* --------------------------------------------------------------------------
   Profile layout
   -------------------------------------------------------------------------- */

.profile-layout {
  display: block !important;
  margin: 0 !important;
}

.profile-layout > .col-md-3,
.profile-layout > .col-md-9 {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  padding: 0 !important;
}

.profile-layout > .col-md-9 {
  margin-top: 16px;
}

.profile-card {
  overflow: hidden;
  border: 1px solid var(--fix-line);
  border-radius: 18px;
  background: var(--fix-card);
}

.profile-cover {
  height: clamp(130px, 18vw, 190px);
}

.profile-identity {
  position: relative;
  padding: 0 22px 18px;
  margin-top: -44px;
}

.profile-avatar-wrap {
  width: 88px;
  height: 88px;
  margin-bottom: 10px;
}

.profile-avatar {
  border: 3px solid var(--fix-card);
  border-radius: 50%;
}

.profile-name {
  padding-right: 0;
  font-size: clamp(22px, 2.6vw, 32px);
}

@media (min-width: 1100px) {
  .profile-identity {
    padding-right: 300px;
  }

  .profile-actions {
    position: absolute;
    top: 16px;
    right: 18px;
    justify-content: flex-end;
    max-width: 275px;
    margin: 0;
  }
}

.profile-site-id {
  justify-content: flex-start;
  width: fit-content;
  margin-top: 7px;
  padding: 4px 8px;
  border: 1px solid var(--fix-line);
  border-radius: 8px;
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
}

.user_menu_short {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  padding: 8px 14px !important;
  overflow-x: auto;
  border-top: 1px solid var(--fix-line);
  scrollbar-width: none;
}

.user_menu_short a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.user_menu_short a.a_active {
  background: var(--fix-accent-soft);
  color: var(--fix-accent);
}

.user_menu_short a svg {
  width: 17px;
  height: 17px;
}

.profile-cover .user_settings {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--fix-line);
  border-radius: 8px;
  background: var(--transparent-20-b, rgba(0, 0, 0, 0.2));
  color: var(--fix-text);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.profile-cover .user_settings svg {
  width: 15px;
  height: 15px;
}

.pf-block {
  border: 1px solid var(--fix-line);
  border-radius: 16px;
  background: var(--fix-card);
}

.pf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
}

.pf-item {
  min-width: 0;
  padding: 12px 14px;
}

.pf-item__value {
  overflow-wrap: anywhere;
}

.profile-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-section-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--fix-line);
  border-radius: 9px;
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
  scrollbar-width: none;
}

.profile-section-tab {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fix-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.profile-section-tab.is-active {
  background: var(--fix-card);
  color: var(--fix-text);
  box-shadow: 0 2px 8px var(--transparent-20-b, rgba(0, 0, 0, 0.1));
}

.profile-content [data-profile-section="stats"],
.profile-content [data-profile-section="activity"] {
  display: none;
}

.profile-content [data-profile-section="stats"].is-active,
.profile-content [data-profile-section="activity"].is-active {
  display: block;
}

.profile-friends-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--fix-line);
  border-radius: 9px;
  background: var(--transparent-3-w, rgba(255, 255, 255, 0.03));
}

.profile-friends-tab {
  flex: 1 1 auto;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fix-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.profile-friends-tab span {
  margin-left: 4px;
  color: var(--fix-text);
}

.profile-friends-tab.is-active {
  background: var(--fix-card);
  color: var(--fix-text);
  box-shadow: 0 2px 8px var(--transparent-20-b, rgba(0, 0, 0, 0.12));
}

.profile-friends-pane[hidden] {
  display: none !important;
}

.settings-section__title {
  margin: 0 0 10px;
  color: var(--fix-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#profileSettings .popup_modal_content {
  width: min(560px, calc(100vw - 32px));
  max-height: 88vh;
  overflow-y: auto;
}

#profileSettings .custom-id-form {
  margin-top: 18px;
}

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */

.modal_users_container .modal_blocks_content {
  width: min(360px, calc(100vw - var(--chat-w, 0px) - 34px));
}

.modal_users_container .modal_blocks_content a.modal_user_item.is-active {
  border-color: var(--fix-accent);
  background: var(--fix-accent-soft);
}

.modal_users_container .modal_blocks_content a h3 mark {
  background: transparent;
  color: var(--fix-accent);
  font-weight: 700;
}

.modal_users_container .modal_blocks_content a h3 {
  color: var(--fix-text);
}

.modal_users_container .modal_blocks_content a.is-admin h3 {
  color: var(--fix-admin);
}

.modal_users_container .modal_blocks_content a p {
  opacity: 0.55;
}

/* --------------------------------------------------------------------------
   Focus / motion
   -------------------------------------------------------------------------- */

.site-chat button:focus-visible,
.site-chat a:focus-visible,
.site-chat textarea:focus-visible,
.attach button:focus-visible,
.attach input:focus-visible,
.online-pill:focus-visible,
.profile-friends-tab:focus-visible,
.profile-section-tab:focus-visible {
  outline: 2px solid var(--fix-accent);
  outline-offset: 2px;
}

@media (max-width: 1099px) {
  .site-chat__msg-actions {
    position: static;
    width: fit-content;
    margin-top: 5px;
    opacity: 1;
    visibility: visible;
  }

  .messenger__delete {
    opacity: 1;
  }
}

@media (hover: none) {
  .site-chat__msg-actions {
    position: static;
    width: fit-content;
    margin-top: 5px;
    opacity: 1;
    visibility: visible;
  }

  .messenger__delete {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-chat,
  .site-chat *,
  .attach,
  .attach *,
  .online-pill,
  .online-pop,
  .profile-friends-tab {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
