.chat-body {
  --chat-safe-bottom: max(env(safe-area-inset-bottom, 0px), 10px);
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(rgba(4, 8, 16, 0.70), rgba(4, 8, 16, 0.86)),
    var(--bg-image, url('/app/1343590.jpg')) center/cover fixed;
}

/* Mobile chat bottom navigation v13. */
@media (max-width: 900px) {
  .chat-body {
    --mm-chat-nav-space: calc(
      var(--mm-bottom-nav-height, 64px) +
      var(--mm-bottom-nav-base-gap, max(10px, env(safe-area-inset-bottom, 0px))) +
      var(--mm-mobile-browser-gap, 0px)
    );
  }

  .chat-body .chat-page {
    height: calc(var(--chat-viewport-height, 100dvh) - var(--mm-chat-nav-space)) !important;
    max-height: calc(var(--chat-viewport-height, 100dvh) - var(--mm-chat-nav-space)) !important;
  }

  .chat-body .chat-shell,
  .chat-body .dialogs-panel,
  .chat-body .conversation-panel,
  .chat-body .conversation-live {
    height: 100% !important;
    max-height: 100% !important;
  }

  .chat-body .chat-shell.is-chat-open .message-form {
    bottom: var(--mm-chat-nav-space) !important;
  }

  .chat-body .chat-shell.is-chat-open .message-list {
    bottom: calc(64px + var(--mm-chat-nav-space)) !important;
  }

  .chat-keyboard-open {
    --mm-chat-nav-space: 0px;
  }

  .chat-keyboard-open .bottom-nav {
    display: none !important;
  }

  .chat-body.chat-keyboard-open .chat-shell.is-chat-open .message-form {
    bottom: 0 !important;
  }

  .chat-body.chat-keyboard-open .chat-shell.is-chat-open .message-list {
    bottom: 58px !important;
  }
}

@media (max-width: 900px) {
  html.mm-ios-standalone .chat-body .chat-page {
    height: calc(var(--chat-viewport-height, 100dvh) - 64px - var(--mm-ios-safe-bottom)) !important;
    max-height: calc(var(--chat-viewport-height, 100dvh) - 64px - var(--mm-ios-safe-bottom)) !important;
    padding-top: var(--mm-ios-safe-top) !important;
  }

  html.mm-ios-standalone .chat-shell.is-chat-open .message-form {
    bottom: calc(64px + var(--mm-ios-safe-bottom)) !important;
    padding-bottom: 8px !important;
  }

  html.mm-ios-standalone .chat-shell.is-chat-open .message-list {
    top: calc(66px + var(--mm-ios-safe-top)) !important;
    bottom: calc(128px + var(--mm-ios-safe-bottom)) !important;
  }

  html.mm-ios-standalone .chat-keyboard-open .chat-shell.is-chat-open .message-form {
    bottom: 0 !important;
  }

  html.mm-ios-standalone .chat-keyboard-open .chat-shell.is-chat-open .message-list {
    bottom: 58px !important;
  }
}

.chat-page {
  width: min(1320px, calc(100% - 32px));
  height: calc(100dvh - 112px);
  min-height: 560px;
  margin: 16px auto;
}

.chat-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(105, 190, 235, 0.22);
  border-radius: 22px;
  background:
    radial-gradient(circle at 0 0, rgba(90, 212, 255, 0.12), transparent 30%),
    radial-gradient(circle at 100% 0, rgba(185, 146, 255, 0.11), transparent 30%),
    rgba(7, 11, 21, 0.86);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255,255,255,0.055);
  backdrop-filter: blur(18px);
}

.dialogs-panel,
.conversation-panel,
.conversation-live {
  min-height: 0;
}

.dialogs-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-right: 1px solid rgba(105, 190, 235, 0.18);
  background: rgba(7, 13, 25, 0.54);
}

.chat-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 12px;
}

.chat-topline h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.chat-topline p {
  margin: 7px 0 0;
  color: rgba(221, 229, 242, 0.58);
  font-size: 13px;
}

.chat-refresh,
.conversation-back,
.message-form button {
  border: 1px solid rgba(117, 210, 255, 0.22);
  color: #eaf7ff;
  background: linear-gradient(135deg, rgba(24, 39, 59, 0.94), rgba(10, 16, 30, 0.94));
  cursor: pointer;
}

.chat-refresh,
.conversation-back {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.chat-refresh svg,
.conversation-back svg,
.message-form button svg {
  width: 20px;
  height: 20px;
}

.dialog-search {
  height: 44px;
  margin: 0 14px 10px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid rgba(117, 210, 255, 0.14);
  border-radius: 15px;
  color: rgba(223, 247, 255, 0.64);
  background: rgba(4, 8, 16, 0.54);
}

.dialog-search svg {
  width: 18px;
  height: 18px;
}

.dialog-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: #edf6ff;
  background: transparent;
  font: inherit;
  font-size: 14px;
}

.dialog-list {
  min-height: 0;
  overflow: auto;
  padding: 0 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dialog-item {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 1px solid rgba(117, 210, 255, 0.10);
  border-radius: 16px;
  color: #edf6ff;
  text-align: left;
  background: rgba(12, 19, 33, 0.58);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.dialog-item:hover,
.dialog-item.active {
  border-color: rgba(105, 205, 255, 0.42);
  background: linear-gradient(135deg, rgba(25, 42, 63, 0.82), rgba(10, 16, 29, 0.86));
}

.dialog-item.unread {
  box-shadow: inset 3px 0 0 #62d9ff;
}

.dialog-item img,
.conversation-avatar {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 15px;
  border: 1px solid rgba(105, 205, 255, 0.24);
  background: rgba(255,255,255,0.04);
}

.dialog-item img[class*="shop-frame-"],
.conversation-avatar[class*="shop-frame-"] {
  padding: 3px;
  background: var(--match-card-frame-ring, linear-gradient(135deg, #5ad4ff, #b992ff));
  box-shadow: 0 0 20px var(--match-card-frame-glow, rgba(90, 212, 255, 0.22));
}

.dialog-main,
.dialog-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dialog-name {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dialog-last {
  margin-top: 4px;
  overflow: hidden;
  color: rgba(221, 229, 242, 0.56);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dialog-side {
  align-items: flex-end;
  gap: 7px;
}

.dialog-time {
  color: rgba(221, 229, 242, 0.45);
  font-size: 11px;
  white-space: nowrap;
}

.dialog-unread {
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  color: #07111c;
  font-size: 11px;
  font-weight: 950;
  background: linear-gradient(135deg, #65dcff, #a8eece);
  box-shadow: 0 0 16px rgba(90, 212, 255, 0.42);
}

.conversation-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 80% 18%, rgba(185, 146, 255, 0.10), transparent 30%),
    rgba(5, 9, 18, 0.32);
}

.conversation-empty {
  margin: auto;
  width: min(420px, calc(100% - 40px));
  text-align: center;
  color: #edf6ff;
}

.conversation-empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(105, 205, 255, 0.24);
  border-radius: 22px;
  color: #9deaff;
  background: rgba(23, 38, 57, 0.58);
}

.conversation-empty-icon svg {
  width: 32px;
  height: 32px;
}

.conversation-empty h2 {
  margin: 0;
  font-size: 26px;
}

.conversation-empty p {
  margin: 10px 0 0;
  color: rgba(221, 229, 242, 0.62);
}

.conversation-live {
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.conversation-live[hidden],
.conversation-empty[hidden] {
  display: none !important;
}

.conversation-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(105, 190, 235, 0.16);
  background: rgba(8, 13, 24, 0.62);
}

.conversation-back {
  display: none;
}

.conversation-user {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.conversation-user strong {
  min-width: 0;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.conversation-user span {
  margin-top: 4px;
  color: rgba(221, 229, 242, 0.52);
  font-size: 12px;
}

.conversation-profile {
  margin-left: auto;
  padding: 10px 14px;
  border: 1px solid rgba(117, 210, 255, 0.18);
  border-radius: 14px;
  color: #dff7ff;
  text-decoration: none;
  font-weight: 850;
  background: rgba(14, 24, 39, 0.74);
}

.conversation-menu-btn {
  position: relative;
  width: 42px;
  height: 42px;
  margin-left: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(117, 210, 255, 0.18);
  border-radius: 14px;
  color: #dff7ff;
  background: rgba(14, 24, 39, 0.74);
  cursor: pointer;
}

.conversation-menu-btn svg {
  width: 20px;
  height: 20px;
}

.conversation-menu {
  position: absolute;
  top: 58px;
  right: 12px;
  z-index: 5;
  min-width: 210px;
  padding: 7px;
  border: 1px solid rgba(117, 210, 255, 0.18);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.96);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
}

.conversation-menu button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  color: #eaf7ff;
  text-align: left;
  font-weight: 850;
  background: transparent;
  cursor: pointer;
}

.conversation-menu button:hover {
  background: rgba(105, 205, 255, 0.10);
}

.message-list {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 12px;
}

.message-row {
  display: flex;
  position: relative;
}

.message-row.own {
  justify-content: flex-end;
}

.message-bubble {
  position: relative;
  max-width: min(560px, 74%);
  padding: 11px 13px 8px;
  border: 1px solid rgba(117, 210, 255, 0.12);
  border-radius: 20px 20px 20px 8px;
  color: #edf6ff;
  background: linear-gradient(180deg, rgba(20, 31, 49, 0.94), rgba(12, 20, 33, 0.94));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
}

.message-row.deleted .message-bubble {
  opacity: 0.68;
}

.message-row.own .message-bubble {
  width: fit-content;
  max-width: min(360px, 68vw, 72%);
  color: #06111d;
  border-color: rgba(255,255,255,0.30);
  border-radius: 20px 20px 8px 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04)),
    linear-gradient(135deg, #7bcfff 0%, #8eb8ff 52%, #ac92ff 100%);
  box-shadow: 0 18px 38px rgba(91, 149, 255, 0.18);
}

.message-bubble.own::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0));
  pointer-events: none;
  opacity: 0.72;
}

.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.42;
  position: relative;
  z-index: 1;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

.message-time {
  opacity: 0.64;
  font-size: 11px;
}

.message-receipt {
  color: rgba(6, 17, 29, 0.64);
  font-size: 11px;
  line-height: 1;
  letter-spacing: -2px;
}

.message-receipt.is-read {
  color: #07506b;
}

.message-edited {
  opacity: 0.56;
  font-size: 10px;
  text-transform: lowercase;
}

.deleted-text {
  font-style: italic;
  opacity: 0.72;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 4;
  pointer-events: none;
}

.message-row:hover .message-actions,
.message-row:focus-within .message-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.message-actions button {
  min-height: 30px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(10, 21, 36, 0.14);
  border-radius: 999px;
  color: rgba(10, 21, 36, 0.82);
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
  cursor: pointer;
}

.message-actions button:hover {
  background: rgba(255, 255, 255, 0.58);
}

.message-actions button.danger {
  color: #5d2130;
  background: rgba(255, 236, 242, 0.55);
}

.message-action-glyph {
  font-size: 12px;
  line-height: 1;
  opacity: 0.84;
}

.message-media {
  display: block;
  margin-bottom: 8px;
}

.message-media.image img,
.message-media.video {
  width: min(320px, 100%);
  max-height: 280px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
}

.message-media.audio {
  width: min(320px, 100%);
}

.message-media.file {
  padding: 10px 12px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  background: rgba(255,255,255,0.12);
}

.message-form {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 48px;
  align-items: end;
  gap: 9px;
  padding: 11px 14px 14px;
  border-top: 1px solid rgba(105, 190, 235, 0.16);
  background: rgba(7, 12, 22, 0.84);
}

.message-input-wrap {
  min-height: 46px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(117, 210, 255, 0.20);
  border-radius: 16px;
  background: rgba(4, 8, 16, 0.70);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.message-form textarea {
  width: 100%;
  min-height: 24px;
  max-height: 112px;
  resize: none;
  padding: 11px 13px 10px;
  border: 0;
  border-radius: 0;
  color: #edf6ff;
  background: transparent;
  outline: none;
  font: inherit;
  line-height: 1.35;
  overflow-y: auto;
  scrollbar-width: none;
}

.message-form textarea::-webkit-scrollbar {
  display: none;
}

.message-input-wrap:focus-within {
  border-color: rgba(105, 205, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(90, 212, 255, 0.10);
}

.message-form button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
}

.message-tool-btn {
  color: #dff7ff;
  background: rgba(16, 28, 45, 0.88);
}

.message-send-btn {
  color: #06111d;
  background: linear-gradient(135deg, #62caff, #9c86ff);
}

.message-form button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.message-form.is-editing {
  box-shadow: inset 0 2px 0 rgba(255, 213, 98, 0.72);
}

.message-form.is-editing .message-input-wrap {
  border-color: rgba(255, 213, 98, 0.44);
}

.chat-state {
  padding: 18px;
  color: rgba(221, 229, 242, 0.66);
  text-align: center;
  line-height: 1.45;
}

.chat-state.inline {
  margin: auto;
}

.chat-name-wrap {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  vertical-align: middle;
}

.chat-name-wrap.compact {
  gap: 5px;
}

.chat-nick-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-nick-text.shop-nick-gold {
  color: #ffe38a !important;
  -webkit-text-fill-color: #ffe38a !important;
  text-shadow: 0 0 14px rgba(255, 207, 97, 0.38);
}

.chat-nick-text[class*="shop-nick-"]:not(.shop-nick-gold) {
  background: linear-gradient(135deg, #5ad4ff, #b992ff, #ff7bc7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none;
}

.chat-profile-badge {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff !important;
  -webkit-text-fill-color: initial !important;
  font-size: 14px;
  line-height: 1;
  background: rgba(255,255,255,0.08);
  filter: drop-shadow(0 0 10px rgba(255, 218, 91, 0.34));
  transform: translateY(1px);
}

.chat-name-wrap.compact .chat-profile-badge {
  width: 18px;
  height: 18px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .chat-body {
    overflow: hidden;
  }

  .chat-page {
    width: 100%;
    height: calc(100dvh - 84px - var(--mm-mobile-browser-gap, 0px));
    min-height: 0;
    margin: 8px 0 0;
    padding: 0 8px var(--chat-safe-bottom);
  }

  .chat-shell {
    grid-template-columns: 1fr;
    border-radius: 18px;
    min-height: 0;
  }

  .dialogs-panel {
    border-right: 0;
  }

  .conversation-panel {
    display: none;
  }

  .chat-shell.is-chat-open .dialogs-panel {
    display: none;
  }

  .chat-shell.is-chat-open .conversation-panel {
    display: flex;
  }

  .conversation-back {
    display: grid;
  }

  .chat-topline {
    padding: 15px 14px 10px;
  }

  .chat-topline h1 {
    font-size: 30px;
  }

  .dialog-search {
    margin: 0 10px 9px;
  }

  .dialog-list {
    padding: 0 8px 10px;
  }

  .conversation-head {
    min-height: 62px;
    padding: 8px 10px;
    gap: 9px;
  }

  .conversation-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .conversation-user strong {
    font-size: 16px;
  }

  .conversation-profile {
    max-width: 86px;
    overflow: hidden;
    padding: 9px 11px;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .message-list {
    padding: 12px 10px 10px;
    gap: 7px;
  }

  .message-bubble {
    max-width: 86%;
    padding: 10px 12px 8px;
  }

  .message-row.own .message-bubble {
    max-width: min(72vw, 280px);
  }

  .message-form {
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    gap: 8px;
    padding: 9px 9px calc(12px + var(--chat-safe-bottom));
    position: sticky;
    bottom: 0;
  }

  .message-form button {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .message-input-wrap {
    min-height: 42px;
    border-radius: 14px;
  }

  .message-form textarea {
    padding: 9px 11px 8px;
    font-size: 15px;
  }

  .conversation-menu {
    top: 54px;
    right: 8px;
    min-width: 200px;
  }

  .message-actions {
    display: none;
  }

  .message-actions button {
    min-height: 28px;
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  .chat-page {
    width: 100%;
    height: calc(100dvh - 76px - var(--mm-mobile-browser-gap, 0px));
    padding: 0 5px var(--chat-safe-bottom);
  }

  .dialog-item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    min-height: 62px;
  }

  .dialog-item img {
    width: 42px;
    height: 42px;
  }

  .conversation-profile {
    display: none;
  }
}

/* Mobile chat: stable Telegram-like conversation */
@media (max-width: 900px) {
  :root {
    --chat-keyboard-lift: 0px;
  }

  .chat-body {
    min-height: 100dvh;
    overflow: hidden;
    background:
      linear-gradient(135deg, rgba(235, 250, 205, 0.78), rgba(139, 221, 170, 0.74)),
      var(--bg-image, url('/app/1343590.jpg')) center / cover fixed !important;
  }

  .chat-body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(circle at 15% 12%, rgba(255, 255, 255, 0.46), transparent 32%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.30), rgba(92, 184, 123, 0.20));
  }

  .chat-body .app-header,
  .chat-body .top-nav,
  .chat-body .site-header {
    display: none !important;
  }

  .chat-page {
    width: 100% !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: env(safe-area-inset-top, 0px) 0 0 !important;
  }

  .chat-shell {
    height: 100%;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .dialogs-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
    border: 0 !important;
    background: rgba(255, 255, 255, 0.86) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .chat-topline {
    min-height: 62px;
    padding: 14px 16px 8px !important;
    color: #111;
  }

  .chat-topline h1 {
    font-size: 32px !important;
    color: #111;
  }

  .chat-topline p {
    color: rgba(17, 17, 17, 0.54) !important;
  }

  .chat-refresh {
    border: 0 !important;
    color: #111 !important;
    background: rgba(239, 244, 238, 0.92) !important;
  }

  .dialog-search {
    margin: 0 14px 10px !important;
    border: 0 !important;
    color: #7a807f !important;
    background: rgba(232, 239, 232, 0.92) !important;
  }

  .dialog-search input {
    color: #111 !important;
  }

  .dialog-list {
    padding: 0 10px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 6px !important;
  }

  .dialog-item {
    min-height: 70px !important;
    grid-template-columns: 52px minmax(0, 1fr) auto !important;
    padding: 10px 12px !important;
    border: 0 !important;
    border-radius: 18px !important;
    color: #111 !important;
    background: rgba(255, 255, 255, 0.72) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  }

  .dialog-item.active,
  .dialog-item:hover {
    background: rgba(225, 247, 222, 0.90) !important;
    transform: none;
  }

  .dialog-item img {
    width: 52px !important;
    height: 52px !important;
    border: 0 !important;
    border-radius: 50% !important;
  }

  .dialog-name {
    color: #111;
    font-size: 16px;
  }

  .dialog-last,
  .dialog-time {
    color: rgba(17, 17, 17, 0.48) !important;
  }

  .dialog-unread {
    color: #fff;
    background: #2aa8ff;
    box-shadow: none;
  }

  .conversation-panel {
    background: transparent !important;
  }

  .conversation-live {
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: transparent !important;
  }

  .conversation-head {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 66px !important;
    padding: 8px 12px !important;
    border: 0 !important;
    border-radius: 0 0 24px 24px;
    background: rgba(232, 255, 211, 0.72) !important;
    box-shadow: 0 8px 22px rgba(74, 134, 75, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .conversation-back,
  .conversation-menu-btn,
  .conversation-profile {
    border: 0 !important;
    color: #111 !important;
    background: rgba(255, 255, 255, 0.58) !important;
    box-shadow: none !important;
  }

  .conversation-avatar {
    width: 44px !important;
    height: 44px !important;
    border: 2px solid rgba(255, 255, 255, 0.86) !important;
    border-radius: 50% !important;
  }

  .conversation-user strong {
    color: #111;
    font-size: 18px !important;
  }

  .conversation-user span {
    color: rgba(17, 17, 17, 0.56) !important;
  }

  .conversation-menu {
    top: calc(62px + env(safe-area-inset-top, 0px)) !important;
    right: 10px !important;
    border: 0 !important;
    color: #111;
    background: rgba(255, 255, 255, 0.94) !important;
  }

  .conversation-menu button {
    color: #111 !important;
  }

  .message-list {
    padding: 14px 10px calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 8px !important;
    scroll-padding-bottom: 98px;
  }

  .message-row {
    padding: 0 2px;
  }

  .message-bubble {
    max-width: min(78vw, 330px) !important;
    padding: 9px 12px 7px !important;
    border: 0 !important;
    border-radius: 18px 18px 18px 5px !important;
    color: #111 !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 2px 7px rgba(58, 92, 54, 0.10);
  }

  .message-row.own .message-bubble {
    max-width: min(78vw, 330px) !important;
    border-radius: 18px 18px 5px 18px !important;
    color: #10320d !important;
    background: #dbffc8 !important;
    box-shadow: 0 2px 8px rgba(64, 132, 64, 0.12);
  }

  .message-bubble.own::before {
    display: none;
  }

  .message-body {
    color: inherit !important;
    font-size: 16px !important;
    line-height: 1.34 !important;
  }

  .message-meta {
    margin-top: 4px !important;
  }

  .message-time,
  .message-edited {
    color: rgba(17, 17, 17, 0.46) !important;
    opacity: 1 !important;
  }

  .message-receipt,
  .message-receipt.is-read {
    color: #27a34a !important;
  }

  .message-form {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: var(--chat-keyboard-lift, 0px);
    z-index: 35;
    grid-template-columns: 48px minmax(0, 1fr) 48px !important;
    align-items: end;
    gap: 8px !important;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    border: 0 !important;
    background: rgba(232, 255, 230, 0.72) !important;
    box-shadow: 0 -8px 24px rgba(67, 124, 71, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: bottom 0.18s ease;
  }

  .message-input-wrap {
    min-height: 46px !important;
    border: 0 !important;
    border-radius: 23px !important;
    background: rgba(255, 255, 255, 0.88) !important;
    box-shadow: none !important;
  }

  .message-input-wrap:focus-within {
    box-shadow: 0 0 0 2px rgba(44, 173, 91, 0.12) !important;
  }

  .message-form textarea {
    min-height: 24px !important;
    max-height: 104px !important;
    padding: 12px 14px 10px !important;
    color: #111 !important;
    font-size: 16px !important;
  }

  .message-form textarea::placeholder {
    color: rgba(17, 17, 17, 0.44);
  }

  .message-form button {
    width: 46px !important;
    height: 46px !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: none !important;
  }

  .message-tool-btn {
    color: #111 !important;
    background: rgba(255, 255, 255, 0.70) !important;
  }

  .message-send-btn {
    color: #fff !important;
    background: #22a6ff !important;
  }

  .message-media.image img,
  .message-media.video {
    max-height: 240px;
    border: 0;
    border-radius: 14px;
  }
}

/* Mobile chat final site-theme controls */
@media (max-width: 900px) {
  .chat-body {
    color: #eaf4ff;
    background:
      radial-gradient(circle at 12% 4%, rgba(90, 212, 255, 0.18), transparent 34%),
      radial-gradient(circle at 88% 12%, rgba(185, 146, 255, 0.20), transparent 32%),
      var(--bg-image, url('/app/1343590.jpg')) center / cover fixed,
      #050913 !important;
  }

  .chat-body::before {
    background: rgba(3, 7, 14, 0.70) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .chat-topline {
    min-height: 66px !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 44px !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 12px 9px !important;
    color: #eef8ff !important;
  }

  .mobile-chat-back {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(111, 216, 255, 0.22);
    border-radius: 16px;
    color: #eef8ff;
    text-decoration: none;
    font-size: 36px;
    line-height: 1;
    background: rgba(7, 13, 24, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  }

  .chat-topline h1 {
    color: #eef8ff !important;
    font-size: 25px !important;
  }

  .chat-topline p {
    color: rgba(224, 237, 252, 0.58) !important;
  }

  .chat-refresh,
  .conversation-back,
  .conversation-menu-btn,
  .conversation-profile,
  .message-tool-btn {
    border: 1px solid rgba(111, 216, 255, 0.18) !important;
    color: #dff7ff !important;
    background: rgba(7, 13, 24, 0.74) !important;
  }

  .dialogs-panel {
    background: rgba(7, 12, 23, 0.78) !important;
  }

  .dialog-search {
    border: 1px solid rgba(111, 216, 255, 0.14) !important;
    color: rgba(224, 237, 252, 0.58) !important;
    background: rgba(255, 255, 255, 0.06) !important;
  }

  .dialog-search input,
  .dialog-name {
    color: #eef8ff !important;
  }

  .dialog-item {
    color: #eef8ff !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(111, 216, 255, 0.10) !important;
  }

  .dialog-item.active,
  .dialog-item:hover {
    background: rgba(90, 212, 255, 0.12) !important;
  }

  .dialog-last,
  .dialog-time {
    color: rgba(224, 237, 252, 0.52) !important;
  }

  .conversation-head {
    border-radius: 0 0 22px 22px !important;
    background: rgba(7, 12, 23, 0.78) !important;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26) !important;
  }

  .conversation-user strong {
    color: #eef8ff !important;
  }

  .conversation-user span {
    color: rgba(224, 237, 252, 0.58) !important;
  }

  .message-bubble {
    color: #eaf4ff !important;
    background: rgba(10, 18, 32, 0.92) !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.20) !important;
  }

  .message-row.own .message-bubble {
    color: #081018 !important;
    background: linear-gradient(135deg, #62d8ff, #a88cff) !important;
  }

  .message-time,
  .message-edited {
    color: rgba(224, 237, 252, 0.54) !important;
  }

  .message-row.own .message-time,
  .message-row.own .message-edited {
    color: rgba(8, 16, 24, 0.55) !important;
  }

  .message-form {
    background: rgba(7, 12, 23, 0.82) !important;
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.24) !important;
  }

  .message-input-wrap {
    border: 1px solid rgba(111, 216, 255, 0.14) !important;
    background: rgba(255, 255, 255, 0.07) !important;
  }

  .message-form textarea {
    color: #eef8ff !important;
  }

  .message-form textarea::placeholder {
    color: rgba(224, 237, 252, 0.46) !important;
  }

  .message-send-btn {
    color: #081018 !important;
    background: linear-gradient(135deg, #62d8ff, #a88cff) !important;
  }
}

/* Mobile chat keyboard final fix v10.1 */
@media (max-width: 900px) {
  :root {
    --chat-viewport-height: 100dvh;
  }

  .chat-page,
  .conversation-live {
    height: var(--chat-viewport-height, 100dvh) !important;
    max-height: var(--chat-viewport-height, 100dvh) !important;
  }

  .message-list {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    overscroll-behavior: contain;
  }

  .chat-keyboard-open .conversation-head {
    min-height: 58px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }

  .chat-keyboard-open .conversation-avatar {
    width: 38px !important;
    height: 38px !important;
  }

  .chat-keyboard-open .message-list {
    padding-top: 8px !important;
    padding-bottom: 62px !important;
  }

  .message-form {
    bottom: 0 !important;
    padding: 7px 9px max(7px, env(safe-area-inset-bottom, 0px)) !important;
    transform: translateZ(0);
  }

  .chat-keyboard-open .message-form {
    padding-bottom: 7px !important;
  }

  .message-input-wrap {
    min-height: 44px !important;
  }

  .message-form textarea {
    max-height: 88px !important;
  }
}

/* Mobile chat real-device viewport fix v11.1 */
@media (max-width: 900px) {
  .chat-body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--chat-viewport-height, 100dvh);
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden !important;
    background: #050913 !important;
  }

  .chat-body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
      linear-gradient(rgba(5, 9, 19, 0.18), rgba(5, 9, 19, 0.30)),
      url('/app/1343590.jpg') center / cover no-repeat;
    filter: blur(1.5px) saturate(1.1);
    transform: scale(1.04);
  }

  .chat-body::before {
    z-index: -1;
    background:
      radial-gradient(circle at 12% 8%, rgba(255, 94, 180, 0.28), transparent 34%),
      radial-gradient(circle at 88% 12%, rgba(90, 212, 255, 0.24), transparent 34%),
      rgba(3, 7, 14, 0.30) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .chat-page,
  .chat-shell,
  .conversation-panel,
  .conversation-live {
    width: 100% !important;
    height: var(--chat-viewport-height, 100dvh) !important;
    max-height: var(--chat-viewport-height, 100dvh) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .chat-shell.is-chat-open .conversation-live {
    display: block !important;
  }

  .chat-shell.is-chat-open .conversation-head {
    position: fixed !important;
    top: env(safe-area-inset-top, 0px) !important;
    left: 0;
    right: 0;
    z-index: 55;
    min-height: 66px !important;
    border-radius: 0 0 22px 22px !important;
  }

  .chat-shell.is-chat-open .message-list {
    position: fixed !important;
    top: calc(66px + env(safe-area-inset-top, 0px)) !important;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10;
    min-height: 0 !important;
    padding: 12px 10px 14px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .chat-shell.is-chat-open .message-form {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0 !important;
    z-index: 60;
  }

  .chat-keyboard-open .chat-shell.is-chat-open .conversation-head {
    min-height: 58px !important;
  }

  .chat-keyboard-open .chat-shell.is-chat-open .message-list {
    top: calc(58px + env(safe-area-inset-top, 0px)) !important;
    bottom: 58px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .chat-keyboard-open .chat-shell.is-chat-open .message-form {
    padding-bottom: 7px !important;
  }
}

/* Chat navigation v14: no app rail on desktop or inside an opened mobile dialog. */
@media (min-width: 901px) {
  .chat-body .bottom-nav { display: none !important; }
}

@media (max-width: 900px) {
  .chat-body.chat-conversation-open .bottom-nav { display: none !important; }
  .chat-body.chat-conversation-open { --mm-chat-nav-space: 0px !important; }
  .chat-body.chat-conversation-open .chat-page,
  .chat-body.chat-conversation-open .chat-shell,
  .chat-body.chat-conversation-open .conversation-panel,
  .chat-body.chat-conversation-open .conversation-live {
    height: var(--chat-viewport-height, 100dvh) !important;
    max-height: var(--chat-viewport-height, 100dvh) !important;
  }
}
