﻿:root {
  --wc-green: #07c160;
  --wc-green-dark: #05a84f;
  --wc-bg: #ededed;
  --wc-bg-top: #f3fbf6;
  --wc-bg-bottom: #e8f2ed;
  --wc-accent-mint: rgba(7, 193, 96, 0.2);
  --wc-accent-sky: rgba(67, 176, 138, 0.16);
  --wc-panel: #f7f7f7;
  --wc-white: #ffffff;
  --wc-line: #d9d9d9;
  --wc-text: #1f1f1f;
  --wc-muted: #7a7a7a;
  --wc-bubble-mine: #dcf8c6;
  --wc-bubble-other: #ffffff;
  --wc-danger: #d93025;
  --wc-ok: #1f8e4d;
  --mobile-nav-height: 66px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans", sans-serif;
  color: var(--wc-text);
  background:
    radial-gradient(circle at 14% 18%, rgba(7, 193, 96, 0.2) 0, rgba(7, 193, 96, 0) 36%),
    radial-gradient(circle at 86% 12%, rgba(13, 164, 109, 0.17) 0, rgba(13, 164, 109, 0) 33%),
    radial-gradient(circle at 75% 85%, rgba(67, 176, 138, 0.16) 0, rgba(67, 176, 138, 0) 32%),
    linear-gradient(155deg, var(--wc-bg-top) 0%, var(--wc-bg-bottom) 100%);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  filter: blur(4px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 360px;
  height: 360px;
  left: -130px;
  top: 120px;
  background: radial-gradient(circle at 40% 40%, var(--wc-accent-mint) 0%, rgba(7, 193, 96, 0) 70%);
  animation: float-bg-blob 20s ease-in-out infinite;
}

body::after {
  width: 420px;
  height: 420px;
  right: -150px;
  top: 40px;
  background: radial-gradient(circle at 50% 50%, var(--wc-accent-sky) 0%, rgba(67, 176, 138, 0) 72%);
  animation: float-bg-blob 24s ease-in-out infinite reverse;
}

@keyframes float-bg-blob {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -18px, 0) scale(1.05);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.container {
  width: min(1220px, calc(100% - 1.4rem));
  margin: 0.9rem auto 1.2rem;
  position: relative;
  z-index: 1;
}

.header {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 255, 252, 0.92) 100%);
  border: 1px solid var(--wc-line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 24px rgba(24, 97, 66, 0.08);
}

.header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.header p {
  margin: 0.32rem 0 0;
  color: var(--wc-muted);
  line-height: 1.35;
}

a {
  color: #2e6da4;
}

a:hover {
  color: var(--wc-green-dark);
}

.card {
  background: var(--wc-white);
  border: 1px solid var(--wc-line);
  border-radius: 10px;
  padding: 0.95rem;
}

.card + .card {
  margin-top: 0.85rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.auth-landing {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.1rem;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.96) 0%, rgba(244, 255, 249, 0.95) 68%, rgba(233, 250, 240, 0.95) 100%);
  border-color: #cce8d8;
  box-shadow: 0 14px 36px rgba(22, 108, 71, 0.14);
  position: relative;
  overflow: hidden;
}

.auth-landing::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -78px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle at 40% 40%, rgba(7, 193, 96, 0.2) 0%, rgba(7, 193, 96, 0.02) 60%, rgba(7, 193, 96, 0) 75%);
  pointer-events: none;
}

.auth-hero {
  margin-bottom: 0.95rem;
  padding: 0.9rem;
  border-radius: 10px;
  border: 1px solid #d9f0e2;
  background: #fbfffd;
}

.auth-hero h2 {
  margin: 0 0 0.35rem;
  font-size: 1.18rem;
}

.auth-hero p {
  margin: 0;
  color: #5f6f66;
  line-height: 1.35;
}

.auth-single {
  border-color: #d5eadf;
  background: #ffffff;
}

.auth-single h3 {
  margin: 0 0 0.75rem;
  font-size: 1.03rem;
}

.auth-links {
  margin-top: 0.82rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.auth-links a {
  font-size: 0.9rem;
  text-decoration: none;
  color: #1d7f4d;
  font-weight: 600;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-block {
  background: #fafafa;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  padding: 0.9rem;
}

.auth-block h2 {
  margin: 0 0 0.72rem;
  font-size: 1.02rem;
}

.auth-form {
  display: grid;
  gap: 0.58rem;
}

label {
  color: #555;
  font-size: 0.88rem;
  font-weight: 600;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.48rem;
  color: #444;
  font-weight: 500;
}

.check-row span {
  line-height: 1.35;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 7px;
  padding: 0.58rem 0.68rem;
  color: var(--wc-text);
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--wc-green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.16);
}

input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
}

button {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.55rem 0.78rem;
  background: var(--wc-green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 130ms ease;
}

button:hover {
  background: var(--wc-green-dark);
}

.error {
  color: var(--wc-danger);
  margin: 0;
  font-weight: 700;
}

.auth-inline-error {
  margin-top: 0.25rem;
  font-size: 0.88rem;
}

.ok {
  color: var(--wc-ok);
  margin: 0;
  font-weight: 700;
}

.muted {
  color: var(--wc-muted);
}

.is-hidden {
  display: none !important;
}

.chat-card {
  padding: 0;
  overflow: hidden;
}

.app-page-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.68rem;
  background: #eef5f1;
  border-top: 1px solid #d5e3db;
  overflow-y: auto;
}

.app-page-view .settings-dialog {
  width: 100%;
  max-width: 100%;
  max-height: none;
  height: auto;
  overflow: visible;
}

.chat-card.app-view-feed .messenger-layout,
.chat-card.app-view-profile .messenger-layout {
  display: none;
}

.chat-card.app-view-feed #feed-modal,
.chat-card.app-view-profile #profile-page-modal {
  display: flex;
}

.chat-card.app-view-feed #profile-page-modal,
.chat-card.app-view-profile #feed-modal {
  display: none;
}

.chat-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.95rem;
  background: var(--wc-green);
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-topbar button {
  background: #fff;
  color: #277a4b;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-topbar button:hover {
  background: #f3fff8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.48rem;
}

.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.2rem;
  padding: 0.3rem 0.36rem calc(0.34rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid #d8e4dd;
  box-shadow: 0 -8px 22px rgba(19, 74, 49, 0.1);
  backdrop-filter: blur(8px);
}

.mobile-nav-item {
  border: 0;
  background: transparent;
  color: #6a6f6d;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  min-width: 0;
  padding: 0.28rem 0.15rem;
  border-radius: 10px;
  font-weight: 700;
}

.mobile-nav-item:hover {
  background: #eef7f1;
  color: #2f6947;
}

.mobile-nav-item.active {
  color: #07c160;
  background: #eefbf3;
}

.mobile-nav-icon {
  font-size: 1.04rem;
  line-height: 1;
}

.mobile-nav-label {
  font-size: 0.68rem;
  line-height: 1;
  white-space: nowrap;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  min-width: 0;
}

.topbar-user > div {
  min-width: 0;
}

.topbar-user-trigger {
  cursor: pointer;
  border-radius: 10px;
  padding: 0.2rem 0.3rem;
  transition: background-color 130ms ease, box-shadow 130ms ease;
}

.topbar-user-trigger:hover {
  background: rgba(255, 255, 255, 0.14);
}

.topbar-user-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.32);
}

.avatar {
  display: inline-block;
  border-radius: 999px;
  object-fit: cover;
  background: #d9efe3;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.avatar-fit-cover {
  object-fit: cover;
}

.avatar-fit-contain {
  object-fit: contain;
  background: #f2f7f4;
}

.avatar-xs {
  width: 20px;
  height: 20px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-md {
  width: 36px;
  height: 36px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
}

.avatar-clickable {
  cursor: zoom-in;
}

.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 40;
}

.settings-dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.avatar-editor-modal {
  position: fixed;
  inset: 0;
  background: rgba(18, 57, 39, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 80;
}

.image-viewer-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 23, 16, 0.78);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 120;
}

.image-viewer-dialog {
  position: relative;
  width: min(96vw, 1100px);
  max-height: 94vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#image-viewer-img {
  max-width: 100%;
  max-height: 94vh;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 26px 56px rgba(0, 0, 0, 0.45);
  background: #0b1611;
}

.image-viewer-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(16, 39, 28, 0.58);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-close:hover {
  background: rgba(30, 80, 56, 0.78);
  border-color: rgba(255, 255, 255, 0.46);
}

.avatar-editor-dialog {
  width: min(690px, calc(100vw - 1.2rem));
  background: linear-gradient(180deg, #ffffff 0%, #f7fff9 100%);
  border: 1px solid #cfe5d9;
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(20, 94, 61, 0.2);
  overflow: hidden;
}

.avatar-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.82rem 1.15rem;
  border-bottom: 1px solid #d9e8df;
  background: linear-gradient(180deg, #ffffff 0%, #f3fcf7 100%);
}

.avatar-editor-header h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.1;
  font-weight: 700;
  color: #1f3d2d;
}

.avatar-editor-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #d0e4d8;
  border-radius: 999px;
  background: #ffffff;
  color: #557161;
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.avatar-editor-close:hover {
  background: #ecfaf2;
  border-color: #b8dec9;
  color: #1f7a4b;
}

.avatar-editor-body {
  padding: 1.05rem 1.15rem 0.92rem;
}

.avatar-editor-text {
  margin: 0 0 0.92rem;
  text-align: center;
  color: #557066;
  line-height: 1.42;
  font-size: 0.9rem;
}

.avatar-editor-workspace {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.92rem;
}

.avatar-editor-canvas-wrap {
  width: min(360px, 62vw);
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #2b3a34;
  border: 1px solid #8cb9a3;
  position: relative;
}

#avatar-editor-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

.avatar-editor-canvas-wrap.dragging #avatar-editor-canvas {
  cursor: grabbing;
}

.avatar-editor-preview-col {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.avatar-editor-preview {
  border-radius: 999px;
  border: 1px solid #c6dfd2;
  background: #edf7f2;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.avatar-editor-preview-large {
  width: 120px;
  height: 120px;
}

.avatar-editor-preview-small {
  width: 56px;
  height: 56px;
}

.avatar-editor-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.15rem 1.08rem;
}

.avatar-editor-actions .tool-btn {
  min-width: 128px;
  border-color: #cde2d7;
  color: #3f5f4f;
  background: #ffffff;
}

.avatar-editor-actions .tool-btn:hover {
  border-color: #a9d6c0;
  background: #eefaf4;
  color: #1e7848;
}

.avatar-editor-save {
  min-width: 196px;
  border: 1px solid var(--wc-green);
  border-radius: 8px;
  background: var(--wc-green);
  color: #ffffff;
  font-weight: 700;
  padding: 0.62rem 1rem;
  box-shadow: 0 8px 20px rgba(7, 193, 96, 0.22);
  transition: background-color 130ms ease, transform 100ms ease;
}

.avatar-editor-save:hover {
  background: var(--wc-green-dark);
  transform: translateY(-1px);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.settings-header h3 {
  margin: 0;
  font-size: 1.06rem;
}

.settings-form + .settings-form {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid #e9e9e9;
}

.settings-avatar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.settings-avatar-controls {
  display: grid;
  gap: 0.4rem;
}

.settings-feedback {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.62rem;
  border-radius: 8px;
  background: #f4f7f5;
  border: 1px solid #dde8e1;
}

.settings-feedback.error {
  color: #a23129;
  background: #fff3f2;
  border-color: #f2d3d0;
}

.settings-feedback.ok {
  color: #1f7f4e;
  background: #edf9f2;
  border-color: #cfe9db;
}

.peer-profile-dialog {
  width: min(460px, 100%);
}

.peer-profile-body {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.peer-profile-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.55rem;
}

.peer-profile-row {
  display: grid;
  gap: 0.18rem;
  padding: 0.46rem 0.55rem;
  border: 1px solid #dce8e1;
  border-radius: 8px;
  background: #f8fcfa;
}

.peer-profile-label {
  font-size: 0.78rem;
  color: #658173;
}

.group-dialog {
  width: min(540px, 100%);
  max-height: min(86vh, 760px);
  overflow: hidden;
}

.group-members-list {
  border: 1px solid #dbe8e1;
  border-radius: 10px;
  background: #f8fcfa;
  min-height: 120px;
  max-height: min(46vh, 380px);
  overflow-y: auto;
  padding: 0.4rem;
  display: grid;
  gap: 0.38rem;
}

.group-members-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #4f5f56;
  margin: 0.2rem 0 0.1rem;
}

.group-member-item {
  display: flex;
  align-items: center;
  gap: 0.56rem;
  border: 1px solid #deebe4;
  border-radius: 9px;
  background: #fff;
  padding: 0.42rem 0.48rem;
  cursor: pointer;
}

.group-member-item:hover {
  background: #f7fcf9;
}

.group-member-item-static {
  cursor: default;
}

.group-member-item-static:hover {
  background: #fff;
}

.group-member-item input[type="checkbox"] {
  margin: 0;
}

.group-member-main {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  min-width: 0;
  flex: 1;
}

.group-member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1e3228;
  font-weight: 600;
}

.group-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.06rem 0.32rem;
  border-radius: 999px;
  border: 1px solid #d3e4da;
  background: #f4fbf7;
  color: #2c6a4a;
  font-size: 0.66rem;
  font-weight: 700;
}

.group-role-badge.admin {
  border-color: #d6d6f1;
  background: #f2f2ff;
  color: #4a4aa3;
}

.group-member-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: auto;
}

.group-member-action-btn {
  border: 1px solid #d7dfda;
  background: #fff;
  color: #486053;
  border-radius: 7px;
  padding: 0.2rem 0.38rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.group-member-action-btn:hover {
  background: #eef8f2;
  border-color: #b7d8c4;
}

.group-member-action-btn.danger {
  border-color: #e8c7c7;
  color: #9f3b3b;
  background: #fff9f9;
}

.group-member-action-btn.danger:hover {
  border-color: #dca8a8;
  background: #fff2f2;
}

.group-link-wrap {
  margin-bottom: 0.38rem;
}

.group-modal-actions-row {
  margin-top: 0.55rem;
  display: flex;
  justify-content: flex-end;
}

.group-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.38rem;
  align-items: center;
}

.group-link-row input[readonly] {
  background: #f7fbf8;
}

.feed-dialog {
  width: min(980px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-page-view .feed-dialog {
  width: 100%;
  max-height: none;
  height: auto;
  overflow: visible;
}

.feed-header-actions {
  display: inline-flex;
  gap: 0.35rem;
}

.feed-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0.78rem;
  min-height: 0;
}

.app-page-view .feed-body {
  flex: initial;
  min-height: initial;
}

.feed-compose {
  border: 1px solid #dce8e1;
  border-radius: 10px;
  background: #f8fcfa;
  padding: 0.72rem;
  min-height: 0;
}

.feed-compose textarea {
  min-height: 100px;
  resize: vertical;
}

.feed-image-preview {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #d8e5de;
  background: #eff6f2;
  object-fit: cover;
  max-height: 200px;
}

.feed-list {
  border: 1px solid #dce8e1;
  border-radius: 10px;
  background: #f8fcfa;
  padding: 0.72rem;
  overflow-y: auto;
  min-height: 0;
  display: grid;
  gap: 0.62rem;
  align-content: flex-start;
}

.app-page-view .feed-list {
  overflow-y: visible;
  max-height: none;
}

.feed-post {
  border: 1px solid #d8e5de;
  border-radius: 10px;
  background: #ffffff;
  padding: 0.62rem;
  display: grid;
  gap: 0.48rem;
}

.feed-post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.feed-author-btn {
  border: 0;
  background: transparent;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  color: inherit;
  cursor: pointer;
}

.feed-author-btn:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.feed-author-btn:focus-visible {
  outline: 2px solid rgba(7, 193, 96, 0.35);
  outline-offset: 2px;
}

.feed-author-name {
  font-weight: 700;
  color: #1e3228;
}

.feed-post-time {
  font-size: 0.76rem;
  color: #76807b;
  white-space: nowrap;
}

.feed-post-image-link {
  display: flex;
  justify-content: center;
  background: #eff4f1;
  border-radius: 10px;
  overflow: hidden;
}

.feed-post-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid #d7e2dc;
  max-height: min(78vh, 980px);
  object-fit: contain;
  background: #eff4f1;
  transition: filter 0.24s ease, opacity 0.24s ease;
}

.feed-post-image[data-full-src] {
  filter: saturate(0.92);
}

.feed-post-image.is-full {
  filter: none;
}

.feed-post-caption {
  color: #2b3b33;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.feed-like-btn {
  justify-self: start;
  border: 1px solid #d3dfd8;
  border-radius: 999px;
  background: #fff;
  color: #4f5f56;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.62rem;
}

.feed-like-btn:hover {
  background: #f6faf7;
  border-color: #c6d8cf;
  color: #4f5f56;
}

.feed-like-btn.active {
  border-color: #efc4c4;
  background: #fff5f5;
  color: #c0392b;
}

.feed-like-btn.active:hover {
  background: #ffecec;
  border-color: #e7b9b9;
  color: #b9382b;
}

.profile-page-dialog {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-page-view .profile-page-dialog {
  width: 100%;
  max-height: none;
  height: 100%;
}

.profile-page-head {
  border: 1px solid #dce8e1;
  border-radius: 10px;
  background: #f8fcfa;
  padding: 0.72rem;
  margin-bottom: 0.72rem;
}

.profile-page-user {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.profile-page-user-meta {
  display: grid;
  gap: 0.18rem;
}

.profile-page-user-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: #1f2f28;
}

.profile-page-user-mention {
  font-size: 0.88rem;
  color: #5d6f66;
}

.profile-page-user-stats {
  font-size: 0.8rem;
  color: #75847d;
}

.profile-page-posts {
  border: 1px solid #dce8e1;
  border-radius: 10px;
  background: #f8fcfa;
  padding: 0.72rem;
  overflow-y: auto;
  min-height: 0;
  display: grid;
  gap: 0.62rem;
  align-content: flex-start;
}

.profile-mention-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.32rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #cfe5d8;
  background: #f4fbf7;
  color: #17653f;
  text-decoration: none;
  font-weight: 700;
}

.profile-mention-link:hover {
  background: #e9f6ef;
  color: #145737;
}

.profile-mention-link:focus-visible {
  outline: 2px solid rgba(7, 193, 96, 0.35);
  outline-offset: 2px;
}

.ws-status {
  font-size: 0.74rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
}

.ws-online {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.ws-offline {
  background: rgba(255, 255, 255, 0.2);
  color: #ffe9e9;
}

.messenger-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  min-height: 72vh;
}

.users-panel {
  background: var(--wc-panel);
  border-right: 1px solid var(--wc-line);
  padding: 0.86rem;
  overflow-y: auto;
}

.users-panel h2 {
  margin: 0 0 0.52rem;
  font-size: 0.98rem;
  letter-spacing: 0.1px;
}

.dialogs-title {
  margin-top: 1rem !important;
}

.users-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.34rem;
}

.user-item {
  width: 100%;
  text-align: left;
  background: #fff;
  color: #2a2a2a;
  border: 1px solid #dfdfdf;
  border-radius: 8px;
  padding: 0.52rem 0.58rem;
}

.contact-name {
  font-weight: 600;
  color: #2a2a2a;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.contact-meta {
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: #6d6d6d;
}

.user-item:hover {
  background: #f4fdf8;
  border-color: #b8eacb;
}

.user-item.active {
  background: #ecfbf2;
  border-color: #8fdeb1;
  color: #1f643f;
}

.dialog-item {
  padding: 0.56rem 0.62rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.58rem;
  row-gap: 0.2rem;
}

.dialog-avatar-col {
  display: flex;
  align-items: center;
}

.dialog-item .avatar {
  width: 44px;
  height: 44px;
}

.dialog-main-col {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.dialog-title {
  font-weight: 700;
  margin: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.dialog-group-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  border: 1px solid #cfe5d8;
  background: #f4fbf7;
  color: #17653f;
  font-size: 0.67rem;
  font-weight: 700;
  vertical-align: middle;
}

.dialog-channel-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  border: 1px solid #c6dbf2;
  background: #edf5ff;
  color: #24588f;
  font-size: 0.67rem;
  font-weight: 700;
  vertical-align: middle;
}

.dialog-preview {
  font-size: 0.88rem;
  color: #707070;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-preview.is-attachment {
  color: #1d8d58;
}

.dialog-side-col {
  min-width: 66px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.24rem;
}

.dialog-time-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.dialog-last-status {
  font-size: 0.82rem;
  line-height: 1;
  font-weight: 700;
  color: #20a357;
}

.dialog-time {
  font-size: 0.8rem;
  color: #8f8f8f;
  white-space: nowrap;
}

.dialog-side-spacer {
  display: inline-block;
  min-height: 1.16rem;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.16rem;
  height: 1.16rem;
  border-radius: 999px;
  background: #07c160;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 0.32rem;
}

#dialogs-list.users-list {
  gap: 0;
}

#dialogs-list > li + li .dialog-item {
  border-top: 1px solid #e8e8e8;
}

#dialogs-list .dialog-item {
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

#dialogs-list .dialog-item.active {
  background: linear-gradient(135deg, #08bf64 0%, #0eb25f 100%);
  border-color: #0eaa5a;
  color: #fff;
}

#dialogs-list .dialog-item.active .dialog-title,
#dialogs-list .dialog-item.active .dialog-preview,
#dialogs-list .dialog-item.active .dialog-time,
#dialogs-list .dialog-item.active .dialog-last-status {
  color: #fff;
}

#dialogs-list .dialog-item.active .dialog-last-status {
  opacity: 0.9;
}

#dialogs-list .dialog-item.active .unread-badge {
  background: rgba(255, 255, 255, 0.26);
  color: #fff;
}

#dialogs-list .dialog-item.active .avatar {
  border-color: rgba(255, 255, 255, 0.42);
}

.dialog-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
}

.dialog-placeholder {
  margin: auto;
  color: #8b8b8b;
  font-size: 0.98rem;
  text-align: center;
}

.dialog-box {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.62rem;
  padding: 0.72rem 0.92rem;
  border-bottom: 1px solid var(--wc-line);
  background: #fafafa;
}

.dialog-header-main {
  min-width: 0;
  font-weight: 700;
}

.dialog-title-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
}

.peer-profile-btn {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border-radius: 8px;
  cursor: pointer;
}

.peer-profile-btn strong {
  font-weight: 700;
}

.peer-profile-btn:hover {
  color: inherit;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.peer-profile-btn:active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.peer-profile-btn:focus-visible {
  outline: 2px solid rgba(7, 193, 96, 0.35);
  outline-offset: 2px;
}

.peer-profile-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.peer-presence {
  font-size: 0.76rem;
  line-height: 1.12;
  font-weight: 600;
  color: #7b817d;
}

.peer-presence.online {
  color: #1e9d57;
}

.peer-presence.offline {
  color: #7b817d;
}

.dialog-tools {
  display: flex;
  gap: 0.4rem;
}

/* Header quick-actions hidden by request */
.dialog-header .dialog-tools {
  display: none !important;
}

.pinned-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.34rem 0.7rem 0.36rem;
  border-bottom: 1px solid #d8e7dc;
  background: #f7fbf8;
}

.pinned-banner-main {
  border: 0;
  background: transparent;
  color: inherit;
  width: 100%;
  margin: 0;
  padding: 0 0 0 0.56rem;
  border-left: 2px solid #51b4e8;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.04rem;
  text-align: left;
  cursor: pointer;
}

.pinned-banner-main:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.pinned-banner-main:focus-visible {
  outline: 2px solid rgba(81, 180, 232, 0.35);
  outline-offset: 2px;
}

.pinned-banner-label {
  color: #2d8dc0;
  font-size: 0.83rem;
  font-weight: 700;
  line-height: 1.1;
}

.pinned-banner-text {
  color: #3c4b45;
  font-size: 0.96rem;
  line-height: 1.18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.pinned-banner-side {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  align-self: center;
}

.pinned-banner-count {
  color: #6d7a74;
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 2.1rem;
  text-align: right;
}

.pinned-banner-open {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  border: 1px solid #d5d9d6;
  background: #fff;
  color: #6a6f6d;
}

.pinned-banner-open:hover {
  background: #f2f8f4;
  border-color: #c0d6c8;
}

.tool-btn {
  background: #fff;
  color: #4a4a4a;
  border: 1px solid #dcdcdc;
  padding: 0.36rem 0.52rem;
  border-radius: 7px;
  font-size: 0.81rem;
  font-weight: 700;
}

.tool-btn:hover {
  background: #effaf4;
  border-color: #b9e6cb;
}

.tool-btn.danger-outline {
  border-color: #e8c7c7;
  color: #9f3b3b;
  background: #fff9f9;
}

.tool-btn.danger-outline:hover {
  border-color: #dca8a8;
  background: #fff1f1;
}

.dialog-tools-panel {
  border-bottom: 1px solid #dcdcdc;
  background: #fafafa;
  padding: 0.56rem 0.78rem;
}

.dialog-tools-title {
  font-weight: 700;
  margin-bottom: 0.42rem;
}

.panel-item {
  width: 100%;
  text-align: left;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #2a2a2a;
  border-radius: 8px;
  margin-bottom: 0.36rem;
}

.panel-item:hover {
  background: #f8fff9;
}

.panel-item-top {
  display: flex;
  justify-content: space-between;
  color: #747474;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
}

.messages {
  background-color: #b7d7a8;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none' stroke='%235f8e67' stroke-opacity='.28' stroke-width='1.6'%3E%3Ccircle cx='18' cy='18' r='7'/%3E%3Cpath d='M44 12h14v14H44z'/%3E%3Cpath d='M82 14c4.971 0 9 4.029 9 9s-4.029 9-9 9-9-4.029-9-9 4.029-9 9-9z'/%3E%3Cpath d='M14 58c0-6.627 5.373-12 12-12s12 5.373 12 12-5.373 12-12 12S14 64.627 14 58z'/%3E%3Cpath d='M50 52h9v9h-9z'/%3E%3Cpath d='M80 50h20v10H80z'/%3E%3Cpath d='M70 84c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10-10-4.477-10-10z'/%3E%3Cpath d='M16 92h16v16H16z'/%3E%3C/svg%3E");
  background-size: auto, 120px 120px;
  background-position: center, center;
  padding: 0.92rem 0.95rem;
  overflow-y: auto;
  flex: 1;
}

.messages::-webkit-scrollbar,
.users-panel::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-thumb,
.users-panel::-webkit-scrollbar-thumb {
  background: #cfcfcf;
  border-radius: 999px;
}

.message-date-divider {
  width: fit-content;
  margin: 0.22rem auto 0.7rem;
  padding: 0.26rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(91, 129, 88, 0.45);
  background: rgba(90, 122, 88, 0.72);
  color: #f2fff1;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.message {
  width: fit-content;
  min-width: 78px;
  max-width: min(78%, 640px);
  background: var(--wc-bubble-other);
  border: 1px solid #d9e7d6;
  border-radius: 16px 16px 16px 6px;
  padding: 0.5rem 0.66rem 0.44rem;
  margin-bottom: 0.48rem;
  box-shadow: 0 1px 1px rgba(30, 70, 37, 0.13);
}

.message.mine {
  margin-left: auto;
  background: #e7ffcd;
  border-color: #cce7b8;
  border-radius: 16px 16px 6px 16px;
}

.message.channel-post {
  max-width: min(84%, 700px);
  margin-right: auto;
  background: #fffef8;
  border-color: #e6dfca;
  border-radius: 16px 16px 16px 6px;
  box-shadow: 0 1px 1px rgba(72, 83, 38, 0.13);
}

.message.channel-post .message-author .avatar {
  width: 26px;
  height: 26px;
}

.message.channel-post .message-author .username {
  color: #214b79;
}

.message.group-post .message-author .username {
  color: #2f679d;
}

.message-media-only {
  width: fit-content;
  max-width: min(78%, 420px);
}

.message-top {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  margin-bottom: 0.23rem;
}

.message-top-compact {
  margin-bottom: 0;
}

.message.private-post .message-top {
  display: none;
}

.message-author {
  display: flex;
  align-items: center;
  gap: 0.38rem;
}

.username {
  font-weight: 700;
  font-size: 0.86rem;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  min-height: 0.82rem;
  margin-top: 0.24rem;
  line-height: 1;
}

.time {
  font-size: 0.78rem;
  color: #7b8c7f;
}

.message.mine .time {
  color: #5c965f;
}

.reply-hint {
  margin: 0.14rem 0 0.34rem;
  padding: 0.34rem 0.48rem;
  border-left: 3px solid #a8bdb0;
  border-radius: 8px;
  background: rgba(236, 243, 237, 0.76);
}

.message.mine .reply-hint {
  border-left-color: #93c778;
  background: rgba(241, 255, 227, 0.74);
}

.reply-hint-link {
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.reply-hint-link:hover {
  background: rgba(255, 255, 255, 0.74);
  border-color: #b6e1c9;
}

.reply-hint-link:focus-visible {
  outline: none;
  border-color: #85cea9;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.18);
}

.reply-label {
  font-size: 0.73rem;
  color: #446e57;
  font-weight: 700;
  margin-bottom: 0.14rem;
}

.reply-text {
  font-size: 0.77rem;
  color: #4b4b4b;
  line-height: 1.3;
  word-break: break-word;
}

.text {
  font-size: 1.03rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.32;
  color: #151b17;
}

.message.mine .text {
  color: #1a2516;
}

.chat-image-link {
  display: inline-block;
  margin-top: 0.34rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #c9d8c8;
  line-height: 0;
  max-width: min(340px, 72vw);
  cursor: zoom-in;
}

.chat-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  background: #eef4ec;
  transition: filter 0.24s ease, opacity 0.24s ease;
}

.chat-image[data-full-src] {
  filter: saturate(0.92);
}

.chat-image.is-full {
  filter: none;
}

.attachment-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: #2a6ca1;
  text-decoration: none;
}

.attachment-link:hover {
  text-decoration: underline;
}

.message.selected {
  border-color: #57b37e;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.18);
}

.message-pending-upload {
  opacity: 0.82;
  border-style: dashed;
}

.message-pending-upload .status {
  color: #3b7b58;
  font-weight: 700;
}

.message.reply-target-flash {
  animation: reply-target-flash 1.2s ease;
}

@keyframes reply-target-flash {
  0% {
    border-color: #2ea86a;
    box-shadow: 0 0 0 0 rgba(7, 193, 96, 0.45);
  }
  45% {
    border-color: #2ea86a;
    box-shadow: 0 0 0 4px rgba(7, 193, 96, 0.22);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(7, 193, 96, 0);
  }
}

.message-context-menu {
  position: fixed;
  width: min(310px, calc(100vw - 16px));
  background: #fff;
  border: 1px solid #d6e5dc;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(21, 90, 59, 0.2);
  z-index: 95;
  overflow: hidden;
}

.msg-menu-reactions {
  display: flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.46rem 0.52rem;
  background: #fff8ef;
  border-bottom: 1px solid #eee2d6;
}

.msg-menu-reaction {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #e4d8c9;
  background: #fff;
  color: #3f3f3f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.08rem;
  padding: 0;
}

.msg-menu-reaction.active {
  border-color: #8dd6af;
  background: #ebf9f1;
}

.msg-menu-reaction:hover {
  background: #f8efe4;
}

.msg-menu-close {
  margin-left: auto;
  background: #ececec;
  border-color: #dddddd;
  color: #6b6b6b;
  font-size: 1rem;
}

.msg-menu-actions {
  padding: 0.34rem 0;
}

.msg-menu-item {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.68rem;
  padding: 0.54rem 0.82rem;
  color: #252525;
  cursor: pointer;
}

.msg-menu-item:hover {
  background: #f1faf5;
}

.msg-menu-icon {
  width: 1.2rem;
  text-align: center;
  color: #4f4f4f;
}

.msg-menu-item.danger {
  color: #9e2d23;
}

.msg-menu-item.danger .msg-menu-icon {
  color: #9e2d23;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  margin: 0;
  font-size: 0.74rem;
  color: #73867b;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.status.is-sent,
.status.is-delivered {
  color: #7f9e8b;
}

.status.is-read {
  color: #33a266;
}

.status.is-pending {
  color: #5d8f6d;
}

.status.channel-views {
  color: #4f6787;
  font-weight: 700;
}

.send-stack {
  border-top: 1px solid var(--wc-line);
  background: #fafafa;
}

.reply-draft {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.78rem 0.38rem;
  border-bottom: 1px dashed #d8e8dd;
  background: #f6fdf9;
}

.reply-draft-body {
  min-width: 0;
}

.reply-draft-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #2b7a4f;
  margin-bottom: 0.12rem;
}

.reply-draft-text {
  font-size: 0.79rem;
  color: #53635b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-draft-clear {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #c8dfd1;
  background: #fff;
  color: #5f7b6d;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  min-width: 28px;
}

.reply-draft-clear:hover {
  background: #edf9f2;
  border-color: #a9d3bc;
  color: #226c43;
}

.send-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  padding: 0.72rem 0.78rem;
}

.send-form .file-input-hidden {
  display: none;
}

.send-form button {
  min-width: 110px;
}

.attachment-draft {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.52rem;
  border: 1px solid #d4e6dc;
  border-radius: 8px;
  background: #f7fffb;
  margin: 0.45rem 0.78rem 0;
}

.attachment-draft-image {
  width: 52px;
  height: 52px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid #c7ddd1;
  cursor: zoom-in;
}

.attachment-draft-meta {
  min-width: 0;
}

.attachment-draft-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #2b4d3d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-draft-state {
  margin-top: 0.14rem;
  font-size: 0.74rem;
  color: #5b7a6c;
}

.attachment-draft-clear {
  border: 1px solid #d2e4da;
  background: #ffffff;
  color: #456758;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attachment-draft-clear:hover {
  background: #edf9f2;
  border-color: #a9d3bc;
  color: #226c43;
}

.file-picker-btn,
.emoji-toggle {
  min-width: 48px !important;
  width: 48px;
  padding-left: 0;
  padding-right: 0;
  font-size: 1.12rem;
  line-height: 1;
}

.file-picker-btn.active {
  background: #e9f9f0;
  border-color: #8fdab0;
  color: #17653f;
}

.mention-suggest {
  border-top: 1px dashed #dbdbdb;
  padding: 0.45rem 0.75rem 0.65rem;
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  background: #fafafa;
}

.mention-option {
  padding: 0.27rem 0.47rem;
  border-radius: 999px;
  background: #fff;
  color: #3d5a4a;
  border: 1px solid #c7e4d2;
  font-size: 0.76rem;
}

.mention-option:hover {
  background: #effaf4;
}

@media (max-width: 980px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .messenger-layout {
    grid-template-columns: 1fr;
  }

  .users-panel {
    border-right: 0;
    border-bottom: 1px solid var(--wc-line);
    max-height: 42vh;
  }

  .message {
    max-width: 92%;
  }

  .dialog-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .send-form {
    grid-template-columns: 1fr;
  }

  .send-form .file-input-hidden {
    display: none;
  }

  .avatar-editor-dialog {
    width: min(690px, calc(100vw - 0.5rem));
  }

  .avatar-editor-body {
    padding: 0.95rem;
  }

  .avatar-editor-workspace {
    flex-direction: column;
    gap: 0.8rem;
  }

  .avatar-editor-canvas-wrap {
    width: min(360px, 84vw);
  }

  .avatar-editor-preview-col {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.8rem;
  }

  .feed-body {
    grid-template-columns: 1fr;
  }

  .feed-dialog,
  .profile-page-dialog {
    width: min(760px, calc(100vw - 0.6rem));
  }
}

@media (max-width: 640px) {
  body::before {
    width: 250px;
    height: 250px;
    left: -110px;
    top: 210px;
  }

  body::after {
    width: 270px;
    height: 270px;
    right: -130px;
    top: 110px;
  }

  .container {
    width: calc(100% - 0.7rem);
    margin-top: 0.5rem;
  }

  .app-page-view {
    padding: 0.52rem;
  }

  .header,
  .card {
    border-radius: 8px;
  }

  .chat-topbar {
    padding: 0.66rem 0.72rem;
  }

  .users-panel,
  .messages {
    padding: 0.72rem;
  }

  .dialog-tools {
    width: 100%;
  }

  .tool-btn {
    flex: 1;
    text-align: center;
  }

  .peer-profile-body {
    flex-direction: column;
    align-items: center;
  }

  .peer-profile-grid {
    width: 100%;
  }
}

.sidebar-tools {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.sidebar-tab {
  background: #fff;
  color: #4c4c4c;
  border: 1px solid #d8d8d8;
  padding: 0.35rem 0.45rem;
}

.sidebar-tab.active {
  background: #e9f9f0;
  color: #17653f;
  border-color: #8fdab0;
}

.sidebar-action-btn {
  width: 100%;
  border: 1px solid #8fdab0;
  background: #e9f9f0;
  color: #17653f;
  border-radius: 10px;
  padding: 0.5rem 0.62rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.sidebar-action-btn:hover {
  background: #dcf4e7;
  border-color: #78c99d;
}

.sidebar-actions-row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.sidebar-actions-row .sidebar-action-btn {
  margin-bottom: 0;
}

.sidebar-action-btn-channel {
  border-color: #9dc7f0;
  background: #eaf4ff;
  color: #1f4f84;
}

.sidebar-action-btn-channel:hover {
  background: #deeeff;
  border-color: #86b4e4;
}

#sidebar-search {
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
}

.dialog-title-row {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  align-items: center;
}

.dialog-title-row .dialog-time {
  font-size: 0.72rem;
  color: #8f8f8f;
  white-space: nowrap;
}

.typing-indicator {
  display: inline-block;
  margin-left: 0.42rem;
  font-size: 0.74rem;
  color: #4b8b64;
  font-weight: 600;
}

.back-btn {
  margin-right: 0.3rem;
  width: auto;
  min-width: 0;
  height: auto;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  font-size: 0.82rem;
  line-height: 1.1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.emoji-toggle {
  min-width: 48px;
}

.emoji-toggle.active {
  background: #e9f9f0;
  border-color: #8fdab0;
  color: #17653f;
}

.emoji-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  padding: 0.45rem 0.72rem;
  border-bottom: 1px dashed #dbdbdb;
  background: #fafafa;
}

.emoji-item {
  min-width: 34px;
  padding: 0.22rem 0.3rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d8d8d8;
  color: #2f2f2f;
}

.emoji-item:hover {
  background: #f3fff8;
}

.dialog-header-main {
  display: flex;
  align-items: center;
  min-width: 0;
}

.send-form {
  grid-template-columns: 1fr auto auto auto;
}

@media (max-width: 980px) {
  body.chat-open-mobile .users-panel {
    display: none;
  }

  body.chat-open-mobile .dialog-panel {
    display: flex;
  }

  body:not(.chat-open-mobile) .dialog-box {
    display: none;
  }

  body:not(.chat-open-mobile) #dialog-placeholder {
    display: flex;
    margin: 1.2rem auto;
  }
}

/* Mobile polish for topbar and dialog header */
@media (max-width: 640px) {
  .chat-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.56rem;
    padding: 0.62rem 0.68rem;
  }

  .topbar-user {
    width: 100%;
    gap: 0.56rem;
  }

  .topbar-user > div {
    line-height: 1.15;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
    gap: 0.4rem;
    align-items: stretch;
  }

  .topbar-actions button {
    min-width: 0;
    width: 100%;
    padding: 0.42rem 0.44rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .ws-status {
    white-space: nowrap;
    text-align: center;
    font-size: 0.7rem;
    padding: 0.16rem 0.38rem;
    align-self: center;
  }

  .dialog-header {
    padding: 0.58rem 0.68rem;
    gap: 0.44rem;
  }

  .dialog-header-main {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.42rem;
    row-gap: 0.24rem;
  }

  .back-btn {
    margin: 0;
    padding: 0.33rem 0.58rem;
    font-size: 0.8rem;
  }

  .peer-profile-btn {
    min-width: 0;
    justify-content: flex-start;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.02rem;
  }

  .peer-presence {
    font-size: 0.72rem;
  }

  .typing-indicator {
    grid-column: 1 / -1;
    margin-left: 0;
    padding-left: 0.1rem;
  }

  .dialog-tools {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.42rem;
  }

  .dialog-tools .tool-btn {
    min-width: 0;
    width: 100%;
    flex: initial;
  }

  .feed-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .feed-list,
  .profile-page-posts {
    padding: 0.6rem;
  }

  .feed-compose {
    padding: 0.6rem;
  }

  .pinned-banner {
    padding: 0.32rem 0.58rem;
    gap: 0.38rem;
  }

  .pinned-banner-main {
    padding-left: 0.48rem;
  }

  .pinned-banner-label {
    font-size: 0.78rem;
  }

  .pinned-banner-text {
    font-size: 0.88rem;
  }

  .pinned-banner-count {
    font-size: 0.74rem;
    min-width: 1.9rem;
  }

  .pinned-banner-open {
    width: 28px;
    height: 28px;
  }

  #dialogs-list .dialog-item {
    padding: 0.5rem 0.52rem;
    column-gap: 0.5rem;
  }

  #dialogs-list .dialog-item .avatar {
    width: 40px;
    height: 40px;
  }

  #dialogs-list .dialog-item .dialog-title {
    font-size: 0.94rem;
  }

  #dialogs-list .dialog-item .dialog-preview {
    font-size: 0.82rem;
  }

  #dialogs-list .dialog-item .dialog-side-col {
    min-width: 58px;
  }
}

@media (max-width: 430px) {
  .chat-topbar {
    padding: 0.56rem 0.58rem;
  }

  .topbar-user > div {
    font-size: 0.9rem;
  }

  .topbar-actions {
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
    grid-template-areas:
      "ws logout";
  }

  .ws-status {
    grid-area: ws;
    justify-self: start;
  }

  #logout-btn {
    grid-area: logout;
  }

  .dialog-header {
    padding: 0.54rem 0.58rem;
  }

  .pinned-banner {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.22rem;
  }

  .pinned-banner-side {
    justify-content: flex-end;
  }

  #dialogs-list .dialog-item .avatar {
    width: 36px;
    height: 36px;
  }

  #dialogs-list .dialog-item .dialog-side-col {
    min-width: 54px;
  }
}

/* Keep page fixed for authenticated chat and scroll only inside chat areas */
body.chat-page {
  height: 100vh;
  overflow: hidden;
}

@supports (height: 100dvh) {
  body.chat-page {
    height: 100dvh;
  }
}

body.chat-page .container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 2.1rem - var(--mobile-nav-height) - env(safe-area-inset-bottom));
  margin-bottom: 0.4rem;
}

@supports (height: 100dvh) {
  body.chat-page .container {
    height: calc(100dvh - 2.1rem - var(--mobile-nav-height) - env(safe-area-inset-bottom));
  }
}

body.chat-page .chat-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.chat-page .messenger-layout {
  flex: 1;
  min-height: 0;
}

body.chat-page .users-panel,
body.chat-page .dialog-panel,
body.chat-page .dialog-box,
body.chat-page .messages {
  min-height: 0;
}

body.chat-page .dialog-box {
  height: 100%;
}

@media (max-width: 980px) {
  body.chat-page .container {
    height: calc(100vh - 1rem - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    margin-bottom: 0.4rem;
  }

  @supports (height: 100dvh) {
    body.chat-page .container {
      height: calc(100dvh - 1rem - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    }
  }
}

@media (max-width: 640px) {
  body.chat-page .container {
    height: calc(100vh - 1rem - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    margin-bottom: 0.5rem;
  }

  @supports (height: 100dvh) {
    body.chat-page .container {
      height: calc(100dvh - 1rem - var(--mobile-nav-height) - env(safe-area-inset-bottom));
    }
  }
}
