:root {
  --bg: #05080d;
  --panel: rgba(15, 25, 36, 0.88);
  --panel-2: rgba(18, 30, 44, 0.92);
  --line: rgba(145, 166, 189, 0.22);
  --text: #f2f7fb;
  --muted: #9cb0c6;
  --green: #5dff86;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(73, 125, 182, 0.18), transparent 32%),
    linear-gradient(180deg, #0b1118 0%, #05080d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.app {
  width: min(1400px, 100%);
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 20px;
}

.phone {
  height: 860px;
  min-height: 860px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(28, 45, 63, 0.98), rgba(10, 14, 20, 0.96)),
    rgba(13, 22, 30, 0.95);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(24, 38, 54, 0.96), rgba(11, 18, 27, 0.96));
}

.phone::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(102, 178, 255, 0.12) 25%,
      transparent 50%,
      rgba(255, 255, 255, 0.04) 75%,
      transparent 100%
    );
  mix-blend-mode: screen;
  opacity: 0.5;
}

.sidebar-header {
  padding: 22px 20px 10px;
  position: relative;
  background: transparent;
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at 50% 35%, rgba(92, 146, 211, 0.18), rgba(8, 14, 20, 0.42));
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, border-color 0.18s ease;
  padding-top: 1px;
}

.logo-wrap:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 10px 22px rgba(83, 145, 220, 0.18));
  border-color: rgba(145, 195, 255, 0.55);
}

.logo-wrap:focus-visible {
  outline: 2px solid rgba(115, 180, 255, 0.5);
  outline-offset: 8px;
}

.logo {
  font-size: 30px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.logo-mark {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.logo-mark span {
  position: absolute;
  width: 8px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(205, 223, 245, 0.8));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  top: 6px;
}

.logo-mark span:nth-child(1) {
  left: 6px;
  transform: rotate(-26deg);
}

.logo-mark span:nth-child(2) {
  left: 16px;
  transform: rotate(-12deg);
}

.logo-mark span:nth-child(3) {
  left: 26px;
  transform: rotate(3deg);
}

.logo-mark b {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
}

.sidebar-profile-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 6px 14px rgba(0,0,0,0.22);
  image-rendering: auto;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.section-title {
  margin: 18px 0 12px;
  letter-spacing: 0.08em;
  font-size: 15px;
  font-weight: 700;
  color: #eef5ff;
  text-transform: uppercase;
  display: none;
}

.search {
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(8, 13, 18, 0.65);
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 0 14px;
  margin-bottom: 12px;
  font-size: 16px;
}

.contacts,
.chats {
  padding: 0 26px;
}

.contacts {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.contact .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.contact.online .dot {
  background: var(--green);
  box-shadow: 0 0 12px rgba(93, 255, 134, 0.8);
}

.contact .status {
  color: var(--green);
  font-size: 14px;
  margin-left: 4px;
}

.chat-item {
  margin-top: 10px;
  padding: 16px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(9, 14, 20, 0.38);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-item.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.28);
  background: linear-gradient(180deg, rgba(27, 39, 53, 0.82), rgba(12, 18, 26, 0.78));
}

.chat-name {
  font-size: 20px;
  font-weight: 700;
}

.chat-preview {
  color: #c8d5e6;
  font-size: 15px;
  opacity: 0.86;
}

.chat-time {
  color: #d5deea;
  font-size: 14px;
  white-space: nowrap;
}

.bottom-nav {
  position: static;
  height: 68px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(5, 10, 15, 0.78);
  backdrop-filter: blur(14px);
}

.nav-btn {
  display: grid;
  place-items: center;
  font-size: 28px;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #eaf3ff;
  cursor: pointer;
}

.nav-btn:last-child {
  border-right: none;
}

.nav-btn-guard {
  padding: 0;
}

.guard-nav-icon {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.guard-nav-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.98);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path fill='black' d='M36 4c7 2 13 5 17 10-3 0-5-1-7-1 2 2 4 4 4 7-3-1-5-2-7-2 3 3 5 6 6 10h-8c-2-2-5-3-9-3 5 4 9 9 10 16 2 10-2 18-10 23-6 4-13 6-21 6 8-3 13-6 17-12-8 1-14-1-18-7-4-6-4-12-1-18 3-5 8-8 15-9-4-2-7-4-10-8 3-5 9-9 22-12zm-9 26c-6 1-10 5-10 10 0 6 5 10 12 10 5 0 10-3 13-8-2-6-7-11-15-12z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path fill='black' d='M36 4c7 2 13 5 17 10-3 0-5-1-7-1 2 2 4 4 4 7-3-1-5-2-7-2 3 3 5 6 6 10h-8c-2-2-5-3-9-3 5 4 9 9 10 16 2 10-2 18-10 23-6 4-13 6-21 6 8-3 13-6 17-12-8 1-14-1-18-7-4-6-4-12-1-18 3-5 8-8 15-9-4-2-7-4-10-8 3-5 9-9 22-12zm-9 26c-6 1-10 5-10 10 0 6 5 10 12 10 5 0 10-3 13-8-2-6-7-11-15-12z'/></svg>");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.16));
}

.chat-screen {
  display: flex;
  flex-direction: column;
  height: 860px;
  min-height: 860px;
  position: relative;
  background:
    linear-gradient(180deg, rgba(18, 28, 40, 0.98), rgba(6, 11, 18, 0.97)),
    var(--panel-2);
}

.chat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
  min-height: 94px;
}

.left-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back {
  font-size: 40px;
  color: #d7e1ee;
  opacity: 0.95;
  display: none;
  cursor: pointer;
  user-select: none;
}

.avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.24));
  font-size: 28px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

.name {
  font-size: 26px;
  font-weight: 800;
}

.sub {
  color: var(--green);
  font-size: 15px;
  margin-top: 2px;
}

.menu {
  font-size: 30px;
  opacity: 0.9;
}

.secure-banner {
  margin: 18px 24px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 12px 16px;
  color: #e8eef7;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.messages {
  flex: 1;
  min-height: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.messages::after {
  display: none;
}

.bubble {
  max-width: 62%;
  padding: 16px 18px;
  border-radius: 18px;
  font-size: 18px;
  line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  position: relative;
}

.bubble.in {
  align-self: flex-start;
  background: rgba(25, 38, 55, 0.88);
}

.bubble.out {
  align-self: flex-end;
  background: rgba(22, 35, 50, 0.95);
}

.meta {
  font-size: 13px;
  color: #d3deea;
  margin-left: 10px;
  white-space: nowrap;
  opacity: 0.85;
}

.bubble-line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer {
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
  background: rgba(6, 10, 15, 0.72);
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

.composer-resize-handle {
  display: none;
}

.composer-resize-handle::before {
  display: none;
}

.input-shell {
  flex: 1;
  min-height: 24px;
  display: block;
  position: relative;
  padding: 0 86px 0 0;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.message-input {
  width: 100%;
  display: block;
  background: transparent;
  border: none;
  outline: none;
  color: #eef5ff;
  font-size: 18px;
  font-family: inherit;
  resize: none;
  min-height: 24px;
  max-height: 180px;
  line-height: 1.4;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 154, 189, 0.35) transparent;
  box-sizing: border-box;
  vertical-align: top;
}

.message-input::-webkit-scrollbar {
  width: 6px;
}

.message-input::-webkit-scrollbar-thumb {
  background: rgba(124, 154, 189, 0.35);
  border-radius: 999px;
}

.message-input::-webkit-scrollbar-track {
  background: transparent;
}

.message-input::placeholder {
  color: #b9c7d8;
  opacity: 0.88;
}

.input-shell,
.input-shell:focus,
.input-shell:focus-within,
.message-input,
.message-input:focus,
.message-input:active {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.composer-picker-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(232, 239, 248, 0.78);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease, opacity 0.18s ease;
  position: absolute;
  bottom: 0;
  z-index: 2;
}

.composer-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.composer-icon-lock {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#encryptToggleButton {
  right: 50px;
}

#mediaPickerButton {
  right: 10px;
}

.composer-picker-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(244, 248, 255, 0.92);
}

.composer-picker-btn:active,
.composer-picker-btn.active {
  transform: scale(0.96);
  background: rgba(97, 70, 138, 0.18);
}

.encrypt-toggle-btn {
  color: rgba(220, 228, 238, 0.84);
  font-size: 18px;
}

.encrypt-toggle-btn.active {
  background: rgba(188, 108, 255, 0.14);
  color: #f1ccff;
  box-shadow: 0 0 0 1px rgba(199, 131, 255, 0.1);
}

.send {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(30, 43, 59, 0.98), rgba(11, 18, 28, 0.98));
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #f3f8ff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  align-self: flex-end;
}

.composer-action-hidden {
  display: none !important;
}

@media (min-width: 901px) {
  .send {
    display: none;
  }

  .send:not(.composer-action-hidden) {
    display: grid !important;
  }

  .composer.editing-message .send {
    display: grid !important;
  }
}

.media-picker-panel {
  position: absolute;
  right: 108px;
  bottom: 94px;
  width: min(420px, calc(100% - 36px));
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(17, 27, 39, 0.98), rgba(9, 15, 23, 0.98));
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  z-index: 40;
}

.media-picker-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.media-picker-tab {
  height: 38px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #aebfd2;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.media-picker-tab.active {
  background: linear-gradient(180deg, rgba(82, 131, 191, 0.88), rgba(47, 82, 126, 0.88));
  color: #f4f8ff;
}

.media-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  max-height: 228px;
  overflow-y: auto;
  padding-right: 4px;
}

.media-picker-grid::-webkit-scrollbar {
  width: 6px;
}

.media-picker-grid::-webkit-scrollbar-thumb {
  background: rgba(124, 154, 189, 0.28);
  border-radius: 999px;
}

.emoji-picker-item,
.sticker-picker-item,
.gif-picker-item {
  min-height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.emoji-picker-item {
  display: grid;
  place-items: center;
  font-size: 28px;
}

.sticker-picker-item,
.gif-picker-item {
  overflow: hidden;
  padding: 0;
}

.sticker-picker-item img,
.gif-picker-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.auth-screen {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  margin: -30px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, rgba(10, 40, 80, 0.35), transparent 45%),
    linear-gradient(180deg, #03070d 0%, #05111f 100%);
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.auth-panel {
  position: relative;
  z-index: 2;
  width: 420px;
  padding: 26px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(6, 14, 24, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.auth-panel h2 {
  margin: 0 0 18px;
  color: #f4f8ff;
  font-size: 22px;
}

.auth-panel input {
  width: 100%;
  display: block;
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(4, 10, 18, 0.92);
  color: #eef6ff;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.auth-panel input::placeholder {
  color: #9ab0c7;
  opacity: 1;
}

.auth-panel button {
  width: 100%;
  display: block;
  margin-top: 4px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #1d3550, #0d1a2b);
  color: #f4f8ff;
  font-size: 16px;
  cursor: pointer;
}

.auth-panel hr {
  border: none;
  height: 1px;
  background: rgba(255,255,255,0.14);
  margin: 20px 0;
}

.globe {
  position: absolute;
  width: 760px;
  height: 760px;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0.42;
  background:
    radial-gradient(circle at center, rgba(81, 166, 255, 0.18), transparent 58%),
    repeating-linear-gradient(
      0deg,
      rgba(140, 200, 255, 0.16) 0 2px,
      transparent 2px 28px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(140, 200, 255, 0.12) 0 2px,
      transparent 2px 32px
    );
  border: 1px solid rgba(180, 220, 255, 0.14);
  box-shadow:
    0 0 100px rgba(56, 130, 255, 0.16),
    inset 0 0 50px rgba(120, 180, 255, 0.10);
  animation: globeRotate 24s linear infinite;
}

.globe::before,
.globe::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(180, 220, 255, 0.16);
}

.globe::before {
  transform: scaleX(0.68);
}

.globe::after {
  transform: scaleY(0.68);
}

.grid-lines {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(90, 160, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 160, 255, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,1) 35%, rgba(0,0,0,1) 100%);
  animation: gridMove 18s linear infinite;
  opacity: 0.35;
}

.city-glow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 260px;
  background:
    radial-gradient(circle at 12% 100%, rgba(58, 146, 255, 0.30), transparent 28%),
    radial-gradient(circle at 32% 100%, rgba(80, 190, 255, 0.22), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(58, 146, 255, 0.26), transparent 34%),
    radial-gradient(circle at 70% 100%, rgba(80, 190, 255, 0.20), transparent 30%),
    radial-gradient(circle at 88% 100%, rgba(58, 146, 255, 0.28), transparent 26%);
  filter: blur(10px);
  opacity: 1;
  pointer-events: none;
}

.auth-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 42%, rgba(120,190,255,0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 42% 58%, rgba(120,190,255,0.80) 0 2px, transparent 3px),
    radial-gradient(circle at 55% 35%, rgba(120,190,255,0.90) 0 2px, transparent 3px),
    radial-gradient(circle at 62% 62%, rgba(120,190,255,0.75) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 46%, rgba(120,190,255,0.75) 0 2px, transparent 3px),
    linear-gradient(rgba(120,190,255,0.18), rgba(120,190,255,0.18)) 30% 42% / 12% 1px no-repeat,
    linear-gradient(rgba(120,190,255,0.16), rgba(120,190,255,0.16)) 42% 58% / 13% 1px no-repeat,
    linear-gradient(rgba(120,190,255,0.14), rgba(120,190,255,0.14)) 55% 35% / 10% 1px no-repeat,
    linear-gradient(rgba(120,190,255,0.14), rgba(120,190,255,0.14)) 62% 62% / 11% 1px no-repeat;
  opacity: 0.55;
  animation: nodesPulse 4s ease-in-out infinite;
  pointer-events: none;
}

.auth-bg::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 240px;
  background:
    linear-gradient(
      to top,
      rgba(35, 110, 210, 0.20) 0%,
      rgba(20, 70, 140, 0.10) 30%,
      transparent 100%
    ),
    repeating-linear-gradient(
      90deg,
      rgba(100, 170, 255, 0.16) 0 2px,
      transparent 2px 24px
    );
  mask-image: linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0));
  opacity: 0.55;
  animation: cityMove 10s linear infinite;
  pointer-events: none;
}

.current-user-box {
  margin: 10px 24px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #dce8f7;
  font-size: 14px;
}

.logout-btn {
  margin-left: 15px;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: #1d3550;
  color: white;
  cursor: pointer;
  font-size: 13px;
}

.logout-btn:hover {
  background: #2b4b70;
}

.user-search-box {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}

.user-search-box input {
  flex: 1;
  min-width: 0;
  padding: 0 14px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(8, 14, 22, 0.72);
  color: #eef6ff;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.user-search-box input::placeholder {
  color: #90a8c2;
}

.user-search-box button {
  height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(45, 73, 109, 0.82), rgba(24, 42, 66, 0.86));
  color: #eef6ff;
  cursor: pointer;
  font-weight: 700;
  box-shadow: none;
}

.user-search-results {
  margin-bottom: 14px;
}

.search-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: #dce8f7;
  margin-bottom: 8px;
}

.add-contact-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #1d3550, #0d1a2b);
  color: white;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

@keyframes gridMove {
  from { transform: translateY(0); }
  to { transform: translateY(48px); }
}

@keyframes globeRotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes nodesPulse {
  0% { opacity: 0.35; }
  50% { opacity: 0.65; }
  100% { opacity: 0.35; }
}

@keyframes cityMove {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 0, 24px 0; }
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }

  .phone {
    height: 860px;
  }
}

#contactsList .contact {
  cursor: pointer;
  transition: background 0.2s ease;
}

#contactsList .contact:hover {
  background: rgba(255,255,255,0.04);
}

.active-chat {
  background: rgba(120, 180, 255, 0.15);
  border-left: 3px solid #76c7ff;
}

.bubble-text {
  word-break: break-word;
  white-space: pre-wrap;
}

.bubble-meta {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.7;
  text-align: right;
}

.read-message {
  background: rgba(255, 230, 120, 0.25) !important;
  border-color: rgba(255, 230, 120, 0.5);
}

.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.unread-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #76c7ff;
  color: #04111d;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.group-box {
  display: flex;
  gap: 10px;
  margin: 10px 0 14px;
}

.group-box input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7, 14, 22, 0.92);
  color: #eef6ff;
  outline: none;
}

.group-box input::placeholder {
  color: #90a8c2;
}

.group-box button {
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #1d3550, #0d1a2b);
  color: white;
  cursor: pointer;
}

#groupsList {
  margin-bottom: 14px;
}

.group-item {
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: #dce8f7;
  margin-bottom: 8px;
  cursor: pointer;
}

.group-item.active-chat {
  background: rgba(120, 180, 255, 0.15);
  border-left: 3px solid #76c7ff;
}

.group-box {
  display: flex;
  gap: 10px;
  margin: 10px 0 14px;
}

.group-box input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7, 14, 22, 0.92);
  color: #eef6ff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.group-box input::placeholder {
  color: #90a8c2;
}

.group-box input:focus {
  border-color: rgba(118, 199, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(118, 199, 255, 0.12);
}

.group-box button {
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #1d3550, #0d1a2b);
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.group-box button:hover {
  opacity: 0.92;
}

.group-box button:active {
  transform: scale(0.98);
}

#groupsList {
  margin-bottom: 14px;
}

#groupsList:empty {
  display: none;
}

.group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: #dce8f7;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.group-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(118, 199, 255, 0.25);
}

.group-item:active {
  transform: scale(0.99);
}

.group-item::before {
  content: "👥";
  font-size: 16px;
  opacity: 0.95;
}

.group-item.active-chat {
  background: rgba(120, 180, 255, 0.15);
  border-color: rgba(118, 199, 255, 0.45);
  box-shadow: inset 3px 0 0 #76c7ff;
}

.chat-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-icon-btn {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: #eef6ff;
  font-size: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  backdrop-filter: blur(10px);
}

.top-icon-btn:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(118, 199, 255, 0.30);
}

.top-icon-btn:active {
  transform: scale(0.96);
}

.top-icon-btn.danger:hover {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.10);
}

.group-menu {
  margin: 14px 22px 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(12px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 10px 35px rgba(0,0,0,0.22);
}

.group-menu button {
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(27, 45, 67, 0.98), rgba(10, 20, 32, 0.98));
  color: #eef6ff;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.group-menu button:hover {
  opacity: 0.96;
  border-color: rgba(118, 199, 255, 0.28);
}

.group-menu button:active {
  transform: scale(0.98);
}

.top-user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-btn {
  background: linear-gradient(180deg, #20384f, #122333);
}

.invite-join-box {
  margin: 14px 22px 0;
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.invite-join-box input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7, 14, 22, 0.92);
  color: #eef6ff;
  font-size: 15px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.invite-join-box input::placeholder {
  color: #90a8c2;
}

.invite-join-box input:focus {
  border-color: rgba(118, 199, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(118, 199, 255, 0.10);
}

.invite-join-box button {
  padding: 0 16px;
  min-width: 112px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #1d3550, #0d1a2b);
  color: #f4f8ff;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.invite-join-box button:hover {
  opacity: 0.94;
}

.invite-join-box button:active {
  transform: scale(0.98);
}

.group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.group-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(118, 199, 255, 0.24);
}

.group-item:active {
  transform: scale(0.992);
}

.group-item::before {
  content: "👥";
  opacity: 0.95;
  font-size: 16px;
}

#groupsList:empty {
  display: none;
}

.current-user-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px 0;
  flex-wrap: wrap;
}

.current-user-box-minimal {
  justify-content: flex-end;
}

.logout-btn {
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #1d3550, #0d1a2b);
  color: #f4f8ff;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.logout-btn:hover {
  opacity: 0.94;
}

.logout-btn:active {
  transform: scale(0.98);
}

@media (max-width: 1100px) {
  .group-menu,
  .invite-join-box,
  .current-user-box {
    margin-left: 16px;
    margin-right: 16px;
    padding-left: 0;
    padding-right: 0;
  }

  .invite-join-box {
    flex-direction: column;
  }

  .invite-join-box button {
    min-height: 48px;
  }
}

.profile-mini {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.profile-mini-info {
  min-width: 0;
}

.profile-mini-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #90a8c2;
}

.profile-avatar-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
}

.profile-avatar-img,
.profile-avatar-large {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: none;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 24px rgba(0,0,0,0.24);
}

.profile-avatar-fallback,
.profile-avatar-large-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.16), rgba(0,0,0,0.24));
  color: #eef6ff;
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 22px;
}

.profile-avatar-emblem {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
}

.profile-avatar-emblem span {
  position: absolute;
  width: 8px;
  height: 24px;
  border-radius: 8px;
  top: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(204, 221, 244, 0.82));
  box-shadow: 0 4px 10px rgba(0,0,0,0.22);
}

.profile-avatar-emblem span:nth-child(1) {
  left: 5px;
  transform: rotate(-26deg);
}

.profile-avatar-emblem span:nth-child(2) {
  left: 16px;
  transform: rotate(-12deg);
}

.profile-avatar-emblem span:nth-child(3) {
  left: 27px;
  transform: rotate(3deg);
}

.profile-avatar-emblem b {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 1;
}

.profile-panel {
  margin: 14px 22px 0;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.22);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-panel-title {
  font-size: 18px;
  font-weight: 800;
  color: #eef6ff;
}

.profile-editor {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
}

.profile-editor-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.profile-avatar-large-wrap {
  width: 120px;
  height: 120px;
}

.profile-avatar-large,
.profile-avatar-large-fallback {
  width: 120px;
  height: 120px;
}

.avatar-upload-btn {
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #20384f, #122333);
  color: #f4f8ff;
  cursor: pointer;
  border: none;
  text-align: center;
}

.profile-editor-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-label {
  font-size: 13px;
  color: #9ab0c7;
}

.profile-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(4, 10, 18, 0.92);
  color: #eef6ff;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.profile-input::placeholder {
  color: #9ab0c7;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .profile-editor {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    margin-left: 16px;
    margin-right: 16px;
  }
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-btn,
.top-icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: #eef6ff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.top-btn:hover,
.top-icon-btn:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(118, 199, 255, 0.30);
}

.top-btn:active,
.top-icon-btn:active {
  transform: scale(0.96);
}

.group-menu {
  margin: 14px 22px 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(12px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 10px 35px rgba(0,0,0,0.22);
}

.group-menu button {
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(27, 45, 67, 0.98), rgba(10, 20, 32, 0.98));
  color: #eef6ff;
  font-size: 14px;
  cursor: pointer;
}

.group-members-picker {
  margin: 14px 22px 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(12px);
}

.group-members-title {
  font-size: 15px;
  font-weight: 700;
  color: #eef6ff;
  margin-bottom: 12px;
}

.group-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: #dce8f7;
  margin-bottom: 8px;
}

.group-member-item button {
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #1d3550, #0d1a2b);
  color: white;
  cursor: pointer;
}

.group-member-item.muted {
  opacity: 0.7;
  justify-content: center;
}

.current-user-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px 0;
  flex-wrap: wrap;
}

.profile-mini {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.profile-mini-info {
  min-width: 0;
}

.profile-mini-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #90a8c2;
}

.profile-avatar-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
}

.profile-avatar-img,
.profile-avatar-large {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: none;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 24px rgba(0,0,0,0.24);
}

.profile-avatar-fallback,
.profile-avatar-large-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.16), rgba(0,0,0,0.24));
  color: #eef6ff;
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 22px;
}

.top-user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-btn {
  background: linear-gradient(180deg, #20384f, #122333);
}

.profile-panel {
  margin: 14px 22px 0;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.22);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-panel-title {
  font-size: 18px;
  font-weight: 800;
  color: #eef6ff;
}

.profile-editor {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
}

.profile-editor-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.profile-avatar-large-wrap {
  width: 120px;
  height: 120px;
}

.profile-avatar-large,
.profile-avatar-large-fallback {
  width: 120px;
  height: 120px;
}

.avatar-upload-btn {
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #20384f, #122333);
  color: #f4f8ff;
  cursor: pointer;
  border: none;
  text-align: center;
}

.profile-editor-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-label {
  font-size: 13px;
  color: #9ab0c7;
}

.profile-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(4, 10, 18, 0.92);
  color: #eef6ff;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.profile-input::placeholder {
  color: #9ab0c7;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: #dce8f7;
  margin-bottom: 8px;
  cursor: pointer;
}

.contact .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #76c7ff;
  flex: 0 0 10px;
}

.group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: #dce8f7;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.group-item:hover,
.contact:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(118, 199, 255, 0.24);
}

.group-item:active,
.contact:active {
  transform: scale(0.992);
}

.group-item.active-chat,
.contact.active-chat {
  background: rgba(120, 180, 255, 0.15);
  border-color: rgba(118, 199, 255, 0.45);
  box-shadow: inset 3px 0 0 #76c7ff;
}

#groupsList:empty,
#userSearchResults:empty {
  display: none;
}

@media (max-width: 1100px) {
  .group-menu,
  .group-members-picker,
  .profile-panel,
  .current-user-box {
    margin-left: 16px;
    margin-right: 16px;
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 900px) {
  .profile-editor {
    grid-template-columns: 1fr;
  }
}

.message-context-menu {
  position: fixed;
  z-index: 9999;
  min-width: 170px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(10, 18, 28, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-context-menu button {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #eef6ff;
  cursor: pointer;
  font-size: 14px;
}

.message-context-menu button:hover {
  background: rgba(255,255,255,0.08);
}

.message-context-menu button:active {
  transform: scale(0.99);
}

.reply-preview-bar {
  margin: 0 22px 8px;
  padding: 9px 12px 9px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(16, 26, 37, 0.94);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.reply-preview-bar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #76c6ff, #5d87ff);
}

.reply-preview-texts {
  min-width: 0;
  padding-left: 4px;
}

.reply-preview-author {
  color: #7dc1ff;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.1;
}

.reply-preview-message {
  color: #d8e3ef;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

.reply-preview-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
}

.bubble-reply {
  margin-bottom: 8px;
  padding: 7px 10px 7px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border-left: 3px solid #69bcff;
  cursor: pointer;
}

.bubble-reply-author {
  color: #7dc1ff;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.1;
}

.bubble-reply-text {
  color: #d7e3ef;
  font-size: 12px;
  opacity: 0.82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-target-highlight {
  border-color: rgba(105, 188, 255, 0.58) !important;
  box-shadow: 0 0 0 2px rgba(105, 188, 255, 0.16), 0 12px 28px rgba(18, 54, 92, 0.24) !important;
}

.bubble-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.bubble-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.045);
  color: #eef6ff;
  font-size: 12px;
  cursor: pointer;
  min-height: 24px;
}

.bubble-reaction.active {
  background: rgba(76, 129, 189, 0.22);
  border-color: rgba(123, 185, 255, 0.24);
}

.bubble-reaction span {
  opacity: 0.86;
  font-size: 11px;
}

.bubble-text.deleted-message {
  color: #9fb0c2;
  font-style: italic;
  opacity: 0.82;
}

.danger-menu-btn {
  border-color: rgba(255, 107, 107, 0.28) !important;
  background: rgba(255, 107, 107, 0.10) !important;
}

.danger-menu-btn:hover {
  background: rgba(255, 107, 107, 0.16) !important;
}

.auth-panel-adidas {
  width: min(470px, calc(100vw - 20px));
  padding: 28px 28px 24px;
  border-radius: 28px;
  border: 1px solid rgba(132, 182, 238, 0.16);
  background:
    linear-gradient(180deg, rgba(6, 14, 24, 0.96), rgba(7, 15, 25, 0.82)),
    rgba(6, 14, 24, 0.72);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(196, 226, 255, 0.04),
    inset 0 0 0 1px rgba(81, 135, 196, 0.05);
}

.auth-brand {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-brand-mark {
  display: flex;
  gap: 7px;
  align-items: flex-end;
  padding-top: 4px;
}

.auth-brand-mark span {
  display: block;
  width: 15px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #ffffff, #d4d4d4);
  box-shadow: 0 10px 24px rgba(255, 255, 255, 0.08);
  transform: skewX(-24deg);
}

.auth-brand-mark span:nth-child(1) {
  height: 32px;
}

.auth-brand-mark span:nth-child(2) {
  height: 42px;
}

.auth-brand-mark span:nth-child(3) {
  height: 54px;
}

.auth-brand-copy {
  flex: 1;
  min-width: 0;
}

.auth-kicker {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
}

.auth-brand-copy h1 {
  margin: 0;
  color: #ffffff;
  font-size: 42px;
  line-height: 0.96;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-brand-copy p {
  margin: 10px 0 0;
  color: #9fabb8;
  font-size: 13px;
  line-height: 1.45;
  max-width: 240px;
}

.auth-section {
  position: relative;
}

.auth-panel-adidas h2 {
  margin-bottom: 14px;
  font-size: 19px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #eef6ff;
  text-shadow: 0 0 14px rgba(99, 173, 255, 0.08);
}

.auth-panel-adidas input {
  margin-bottom: 10px;
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid rgba(115, 155, 200, 0.2);
  background:
    linear-gradient(180deg, rgba(7, 15, 25, 0.98), rgba(4, 10, 18, 0.98));
  color: #ffffff;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.auth-panel-adidas input:focus {
  border-color: rgba(98, 190, 255, 0.48);
  box-shadow:
    0 0 0 4px rgba(76, 132, 182, 0.1),
    0 0 18px rgba(55, 120, 191, 0.12);
  transform: translateY(-1px);
}

.auth-panel-adidas input::placeholder {
  color: #6d8399;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.auth-main-btn {
  position: relative;
  overflow: hidden;
  padding: 16px 18px !important;
  border-radius: 14px !important;
  background:
    linear-gradient(180deg, #183149, #0d1b2b) !important;
  color: #eef6ff !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 1px solid rgba(109, 170, 230, 0.18);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(177, 221, 255, 0.08);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.auth-main-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      120deg,
      transparent 0%,
      transparent 38%,
      rgba(76, 208, 255, 0.22) 50%,
      transparent 62%,
      transparent 100%
    );
  transform: translateX(-120%);
  transition: transform 0.45s ease;
}

.auth-main-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.34),
    0 0 22px rgba(67, 147, 227, 0.1);
  filter: brightness(1.02);
}

.auth-main-btn:hover::after {
  transform: translateX(120%);
}

.auth-main-btn:active {
  transform: translateY(0);
}

.auth-panel-adidas hr {
  height: 1px;
  margin: 18px 0 20px;
  background: linear-gradient(90deg, transparent, rgba(129, 186, 240, 0.2), transparent);
}

.auth-stripes {
  position: absolute;
  display: flex;
  gap: 18px;
  opacity: 0.035;
  pointer-events: none;
}

.auth-stripes span {
  display: block;
  width: 34px;
  height: 340px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(142, 202, 255, 0.78), rgba(255, 255, 255, 0.05));
  transform: skewX(-24deg);
}

.auth-stripes-left {
  left: 7%;
  top: 8%;
  transform: rotate(-12deg);
}

.auth-stripes-right {
  right: 8%;
  bottom: 8%;
  transform: rotate(18deg);
}

.auth-brand-soft {
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.auth-brand-mark-soft span {
  width: 11px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgba(224, 241, 255, 0.95), rgba(116, 177, 255, 0.82));
  box-shadow: 0 8px 20px rgba(85, 155, 255, 0.16);
}

.auth-brand-copy-soft h1 {
  font-size: 30px;
  letter-spacing: 0.08em;
  text-transform: none;
}

.auth-brand-copy-soft p {
  max-width: 280px;
  color: #a9bdd2;
}

.auth-main-btn-soft {
  letter-spacing: 0.12em;
}

.auth-brand-logo-only {
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 22px;
  gap: 14px;
}

.auth-logo-orbit {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at 50% 40%, rgba(87, 146, 210, 0.11), rgba(9, 17, 28, 0.02));
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, 0.24),
    0 0 40px rgba(83, 146, 219, 0.16);
}

.auth-logo-orbit::before,
.auth-logo-orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.auth-logo-orbit::before {
  border: 1px solid rgba(148, 188, 226, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 0 18px rgba(77, 129, 196, 0.08);
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 16px,
      rgba(153, 200, 244, 0.05) 16px 17px,
      transparent 17px 33px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0 16px,
      rgba(153, 200, 244, 0.045) 16px 17px,
      transparent 17px 33px
    );
  mask-image: radial-gradient(circle, transparent 72px, #000 73px);
  opacity: 0.9;
  animation: authOuterGlobeSpin 22s linear infinite;
}

.auth-logo-orbit::after {
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 67%, rgba(95, 151, 214, 0.18) 68%, transparent 69%),
    linear-gradient(rgba(133, 188, 240, 0.12), rgba(133, 188, 240, 0.12)) center / 1px 82% no-repeat,
    linear-gradient(90deg, rgba(133, 188, 240, 0.12), rgba(133, 188, 240, 0.12)) center / 82% 1px no-repeat;
  opacity: 0.55;
  animation: authOuterPulse 4.8s ease-in-out infinite;
}

.auth-logo-core {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, rgba(170, 206, 245, 0.18), rgba(14, 23, 37, 0.1)),
    radial-gradient(circle at 50% 50%, rgba(59, 104, 168, 0.22), rgba(14, 23, 37, 0));
  box-shadow: inset 0 0 20px rgba(62, 107, 168, 0.16);
}

.auth-logo-glyph {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  transform: translateY(-6px);
}

.auth-logo-glyph span {
  display: block;
  width: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f8fbff 0%, #d8e3f1 100%);
  box-shadow:
    inset 0 -4px 10px rgba(77, 113, 156, 0.22),
    0 8px 18px rgba(0, 0, 0, 0.16);
}

.auth-logo-glyph span:nth-child(1) {
  height: 48px;
  transform: rotate(-26deg);
}

.auth-logo-glyph span:nth-child(2) {
  height: 52px;
  transform: rotate(-12deg);
}

.auth-logo-glyph span:nth-child(3) {
  height: 48px;
  transform: rotate(2deg);
}

.auth-logo-lock {
  position: absolute;
  z-index: 1;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
}

.auth-brand-caption {
  text-align: center;
  max-width: 300px;
}

.auth-brand-caption .auth-kicker {
  margin-bottom: 8px;
  color: #9ec8ef;
  text-shadow: 0 0 10px rgba(60, 145, 230, 0.18);
}

.auth-brand-caption p {
  margin: 0;
  color: #d4e7fb;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(84, 160, 237, 0.18);
}

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

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

@keyframes authOuterPulse {
  0% {
    opacity: 0.34;
  }

  50% {
    opacity: 0.62;
  }

  100% {
    opacity: 0.34;
  }
}

@media (max-width: 700px) {
  .auth-brand {
    gap: 14px;
  }

  .auth-brand-copy h1 {
    font-size: 34px;
  }

  .auth-stripes span {
    height: 220px;
    width: 24px;
  }
}

@media (max-width: 640px) {
  .auth-screen {
    min-height: 100dvh;
    margin: 0;
    padding: 16px 12px;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
  }

  .auth-panel,
  .auth-panel-adidas {
    width: min(100%, 420px);
    margin: auto 0;
    padding: 18px 16px 16px;
    border-radius: 20px;
  }

  .auth-brand,
  .auth-brand-logo-only {
    margin-bottom: 16px;
    padding-bottom: 14px;
    gap: 10px;
  }

  .auth-logo-orbit {
    width: 112px;
    height: 112px;
  }

  .auth-logo-core {
    width: 72px;
    height: 72px;
  }

  .auth-logo-glyph {
    gap: 4px;
    transform: translateY(-4px);
  }

  .auth-logo-glyph span {
    width: 12px;
  }

  .auth-logo-glyph span:nth-child(1) {
    height: 30px;
  }

  .auth-logo-glyph span:nth-child(2) {
    height: 34px;
  }

  .auth-logo-glyph span:nth-child(3) {
    height: 30px;
  }

  .auth-logo-lock {
    bottom: 4px;
    font-size: 18px;
  }

  .auth-brand-caption .auth-kicker {
    margin-bottom: 6px;
    font-size: 10px;
    letter-spacing: 0.18em;
  }

  .auth-brand-caption p {
    font-size: 16px;
    letter-spacing: 0.14em;
  }

  .auth-panel h2,
  .auth-panel-adidas h2 {
    margin-bottom: 10px;
    font-size: 15px;
    letter-spacing: 0.08em;
  }

  .auth-panel input,
  .auth-panel-adidas input {
    margin-bottom: 8px;
    padding: 12px 13px;
    border-radius: 12px;
    font-size: 15px;
  }

  .auth-panel-adidas input::placeholder {
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .auth-main-btn,
  .auth-panel button {
    margin-bottom: 12px;
    padding: 13px 14px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    letter-spacing: 0.1em;
  }

  .auth-panel hr,
  .auth-panel-adidas hr {
    margin: 14px 0 16px;
  }

  .auth-section {
    gap: 0;
  }

  .auth-stripes,
  .globe,
  .city-glow {
    opacity: 0.18;
  }
}

.members-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.members-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 18, 0.58);
  backdrop-filter: blur(6px);
}

.members-modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(460px, calc(100vw - 32px));
  max-height: min(78vh, 700px);
  transform: translate(-50%, -50%);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(16, 26, 40, 0.98), rgba(7, 14, 24, 0.98));
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  overflow: hidden;
}

.members-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.members-modal-title {
  font-size: 22px;
  font-weight: 800;
  color: #eef6ff;
}

.members-modal-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #8fb1cf;
}

.members-modal-list {
  padding: 10px;
  max-height: calc(78vh - 90px);
  overflow-y: auto;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 16px;
  transition: background 0.18s ease;
}

.member-row:hover {
  background: rgba(255,255,255,0.04);
}

.member-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: 0 0 46px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.15), rgba(0,0,0,0.22));
  display: grid;
  place-items: center;
  color: #eef6ff;
  font-weight: 700;
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-info {
  min-width: 0;
  flex: 1;
}

.member-name {
  font-size: 16px;
  font-weight: 700;
  color: #eef6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-role {
  margin-top: 3px;
  font-size: 13px;
  color: #8fb1cf;
}

.member-badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(118, 199, 255, 0.12);
  border: 1px solid rgba(118, 199, 255, 0.22);
  color: #bfe5ff;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .members-modal-card {
    width: calc(100vw - 18px);
    border-radius: 18px;
  }

  .members-modal-title {
    font-size: 19px;
  }
}

.member-profile-card {
  width: min(420px, calc(100vw - 32px));
}

.member-profile-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.member-profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.15), rgba(0,0,0,0.22));
  display: grid;
  place-items: center;
  color: #eef6ff;
  font-size: 34px;
  font-weight: 700;
}

.member-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-profile-name {
  font-size: 22px;
  font-weight: 800;
  color: #eef6ff;
}

.member-profile-nick {
  font-size: 15px;
  color: #77bfff;
  font-weight: 700;
}

.member-profile-role {
  font-size: 14px;
  color: #8fb1cf;
}

.member-profile-actions {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.group-message-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(86, 128, 186, 0.38), rgba(33, 58, 91, 0.68));
  color: #eef6ff;
  font-size: 14px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
  cursor: pointer;
}

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

.group-message-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 62%;
}

.group-message-stack .bubble {
  max-width: 100%;
}

.group-message-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-message-head .bubble-sender {
  margin: 0;
  cursor: pointer;
}

.member-admin-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(118, 199, 255, 0.22);
  background: rgba(118, 199, 255, 0.10);
  color: #bfe5ff;
  font-size: 12px;
  cursor: pointer;
}

.member-admin-btn:hover {
  background: rgba(118, 199, 255, 0.16);
}

.media-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(30, 43, 59, 0.98), rgba(11, 18, 28, 0.98));
  color: #f3f8ff;
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.media-btn:active {
  transform: scale(0.96);
}

.attach-btn {
  width: 48px;
  height: 48px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(18, 26, 36, 0.78);
  color: rgba(233, 239, 246, 0.86);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.attach-icon {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bubble-image {
  display: block;
  max-width: 260px;
  width: 100%;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
  cursor: zoom-in;
}

.bubble-image-caption {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.45;
  color: #eef5ff;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-invite-link {
  color: #8fd1ff;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(143, 209, 255, 0.55);
  cursor: pointer;
}

.bubble-invite-link:hover {
  color: #dff2ff;
  text-decoration-color: rgba(223, 242, 255, 0.78);
}

.image-preview-card {
  width: fit-content;
  max-width: min(860px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(11, 18, 27, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 56px rgba(0,0,0,0.28);
}

.image-preview-body {
  padding: 8px 8px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.image-preview-large {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  border-radius: 20px;
  object-fit: contain;
  box-shadow: 0 16px 34px rgba(0,0,0,0.18);
}

.image-preview-actions {
  padding: 12px 14px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.image-preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(8, 14, 22, 0.52);
  color: #eef6ff;
  display: grid;
  place-items: center;
  font-size: 22px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.image-preview-nav-prev {
  left: 14px;
}

.image-preview-nav-next {
  right: 14px;
}

#imagePreviewModal {
  z-index: 16000;
}

#imagePreviewModal .members-modal-backdrop {
  background: rgba(4, 9, 16, 0.34);
  backdrop-filter: blur(10px);
}

#imagePreviewModal .members-modal-header {
  padding: 12px 14px 0;
}

#imagePreviewModal .members-modal-title {
  font-size: 15px;
}

#imagePreviewModal .members-modal-subtitle {
  color: #9eb1c6;
}

.bubble-audio {
  width: 220px;
  margin-top: 6px;
}

.voice-record-status {
  min-width: 188px;
  padding: 0 18px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid rgba(255, 107, 120, 0.28);
  background:
    linear-gradient(180deg, rgba(45, 17, 24, 0.98), rgba(20, 11, 18, 0.98));
  color: #f5f8ff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow:
    0 12px 28px rgba(58, 10, 16, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.call-overlay {
  position: absolute;
  inset: 84px 18px auto auto;
  z-index: 35;
}

.call-overlay-card {
  min-width: 260px;
  max-width: min(320px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(16, 26, 40, 0.98), rgba(8, 14, 24, 0.98));
  box-shadow: 0 18px 46px rgba(0,0,0,0.34);
  backdrop-filter: blur(14px);
}

.call-overlay-title {
  color: #f4f9ff;
  font-size: 16px;
  font-weight: 800;
}

.call-overlay-status {
  margin-top: 6px;
  color: rgba(224, 235, 245, 0.72);
  font-size: 13px;
  line-height: 1.35;
}

.call-overlay-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

#callRemoteAudio {
  display: none;
}

.voice-record-status::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff6b78;
  box-shadow: 0 0 18px rgba(255, 107, 120, 0.78);
  animation: voiceRecordPulse 1s ease-in-out infinite;
}

.media-btn.recording {
  border-color: rgba(255, 107, 120, 0.5);
  background: linear-gradient(180deg, rgba(118, 38, 53, 0.98), rgba(58, 17, 26, 0.98));
  box-shadow:
    0 12px 30px rgba(77, 17, 28, 0.28),
    0 0 24px rgba(255, 107, 120, 0.22);
}

.composer.recording-voice {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 -8px 24px rgba(88, 12, 25, 0.12);
}

.composer.recording-voice .input-shell {
  border-color: rgba(255, 107, 120, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 0 0 3px rgba(255, 107, 120, 0.05);
}

.voice-note {
  min-width: 240px;
  max-width: 280px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

.voice-play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(82, 152, 230, 0.26), rgba(36, 87, 145, 0.2));
  color: #eef6ff;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.voice-play-btn:hover {
  filter: brightness(1.05);
}

.voice-note-body {
  min-width: 0;
}

.voice-wave {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.voice-wave-bar {
  width: 4px;
  border-radius: 999px;
  background: rgba(208, 226, 246, 0.36);
  transition: background 0.2s ease, opacity 0.2s ease;
}

.voice-note.playing .voice-wave-bar {
  background: rgba(143, 209, 255, 0.78);
}

.voice-progress {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
  margin-top: 4px;
}

.voice-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, #8ad2ff, #d7efff);
  border-radius: inherit;
}

.voice-note-meta {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: rgba(224, 237, 250, 0.76);
}

.voice-note-badge {
  color: rgba(167, 212, 255, 0.8);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
}

.media-btn,
.send,
.voice-play-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.voice-audio {
  display: none;
}

@keyframes voiceRecordPulse {
  0% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.45; transform: scale(0.9); }
}

.bubble-sender {
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 6px;
}

.media-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(30, 43, 59, 0.98), rgba(11, 18, 28, 0.98));
  color: #f3f8ff;
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.media-btn:active {
  transform: scale(0.96);
}

.bubble-image {
  display: block;
  max-width: 260px;
  width: 100%;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
}

.bubble-video {
  display: block;
  max-width: 260px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(6, 12, 19, 0.92);
}

.bubble-audio {
  width: 220px;
  margin-top: 6px;
}

.bubble-sender {
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 6px;
}

.media-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(30, 43, 59, 0.98), rgba(11, 18, 28, 0.98));
  color: #f3f8ff;
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.media-btn:active {
  transform: scale(0.96);
}

.bubble-image {
  display: block;
  max-width: 260px;
  width: 100%;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
}

.bubble-audio {
  width: 220px;
  margin-top: 6px;
}

.bubble-sender {
  font-size: 12px;
  opacity: 0.72;
  margin-bottom: 6px;
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.member-admin-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(118, 199, 255, 0.22);
  background: rgba(118, 199, 255, 0.10);
  color: #bfe5ff;
  font-size: 12px;
  cursor: pointer;
}

.member-admin-btn:hover {
  background: rgba(118, 199, 255, 0.16);
}

.member-remove-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 107, 107, 0.24);
  background: rgba(255, 107, 107, 0.10);
  color: #ffd0d0;
  font-size: 12px;
  cursor: pointer;
}

.member-remove-btn:hover {
  background: rgba(255, 107, 107, 0.16);
}

#editMessageModal {
  position: fixed;
  inset: 0;
  z-index: 12000;
}

#editMessageModal .members-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 18, 0.58);
  backdrop-filter: blur(6px);
}

#editMessageModal .members-modal-card.edit-message-card {
  position: fixed;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(16, 26, 40, 0.98), rgba(7, 14, 24, 0.98));
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  overflow: hidden;
  box-sizing: border-box;
  margin: 0;
}

.edit-message-body {
  padding: 16px;
  box-sizing: border-box;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
}

.edit-message-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 220px;
  resize: vertical;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7, 14, 22, 0.92);
  color: #eef6ff;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}

.edit-message-textarea::placeholder {
  color: #8fa8c2;
}

.edit-message-textarea:focus {
  border-color: rgba(118, 199, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(118, 199, 255, 0.08);
}

.edit-message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  #editMessageModal .members-modal-card.edit-message-card {
    top: 10px;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .edit-message-body {
    max-height: calc(100vh - 130px);
    padding: 14px;
  }

  .edit-message-textarea {
    min-height: 100px;
    max-height: 180px;
  }
}

.system-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20000;
  min-width: 240px;
  max-width: min(460px, calc(100vw - 24px));
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(118, 199, 255, 0.18);
  background: linear-gradient(180deg, rgba(14, 24, 36, 0.98), rgba(8, 14, 24, 0.98));
  color: #eef6ff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.36);
  text-align: center;
  backdrop-filter: blur(12px);
}

.system-dialog {
  position: fixed;
  inset: 0;
  z-index: 21000;
}

.system-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 18, 0.68);
  backdrop-filter: blur(7px);
}

.system-dialog-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 28px));
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(118, 199, 255, 0.14);
  background: linear-gradient(180deg, rgba(15, 24, 37, 0.98), rgba(8, 14, 24, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.system-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pending-image-preview-bar {
  margin: 0 22px 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(16, 26, 37, 0.94);
  display: flex;
  align-items: center;
  gap: 12px;
}

.pending-image-preview-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex: 0 0 52px;
}

.pending-image-preview-texts {
  min-width: 0;
  flex: 1;
}

.pending-image-preview-title {
  color: #eef5ff;
  font-size: 13px;
  font-weight: 700;
}

.pending-image-preview-sub {
  margin-top: 4px;
  color: #9db0c5;
  font-size: 12px;
  line-height: 1.35;
}

.edit-composer-bar {
  margin: 0 22px 8px;
  padding: 10px 12px 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(24, 24, 30, 0.96), rgba(18, 18, 24, 0.96));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}

.edit-composer-bar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d57aff, #8e6dff);
}

.edit-composer-texts {
  min-width: 0;
  padding-left: 4px;
  flex: 1;
}

.edit-composer-title {
  color: #e5a9ff;
  font-size: 14px;
  font-weight: 800;
}

.edit-composer-subtitle {
  margin-top: 3px;
  color: #aab4c2;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-dialog-title {
  font-size: 20px;
  font-weight: 800;
  color: #eef6ff;
}

.system-dialog-message {
  margin-top: 14px;
  color: #cbd8e7;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.system-dialog-input {
  width: 100%;
  min-height: 52px;
  max-height: 120px;
  margin-top: 14px;
  padding: 14px 16px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(7, 14, 22, 0.92);
  color: #eef6ff;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.system-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

#contactsList,
#groupsList {
  display: grid;
  gap: 10px;
  align-content: start;
}

.sidebar-scroll-area {
  flex: 1;
  min-height: 0;
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  height: auto;
  padding-bottom: 12px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 154, 189, 0.28) transparent;
}

#contactsList,
#groupsListWrap {
  flex: 0 0 auto;
  min-height: auto;
  height: auto;
  overflow: visible;
  padding-right: 0;
}

.sidebar-scroll-area::-webkit-scrollbar {
  width: 6px;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(124, 154, 189, 0.28);
  border-radius: 999px;
}

.sidebar-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 6px;
  margin: 8px 0 12px;
  padding: 5px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(19, 29, 41, 0.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  backdrop-filter: blur(10px);
}

.sidebar-tab {
  height: 40px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #aebdcf;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  padding: 0 10px;
  white-space: nowrap;
}

.sidebar-tab:hover {
  color: #e8f2ff;
  background: rgba(255,255,255,0.035);
}

.sidebar-tab.active {
  color: #eef6ff;
  background: linear-gradient(180deg, rgba(73, 112, 158, 0.58), rgba(43, 67, 97, 0.58));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.telegram-list-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 14px !important;
  border-radius: 16px !important;
  border: none !important;
  background: linear-gradient(180deg, rgba(20, 29, 40, 0.34), rgba(12, 19, 28, 0.28)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.015);
  backdrop-filter: blur(10px);
}

.telegram-list-item.group-item::before {
  display: none !important;
}

.group-list-badge {
  display: none !important;
}

.group-list-badge.is-shield {
  display: none !important;
}

.telegram-list-item:hover {
  background: linear-gradient(180deg, rgba(31, 45, 61, 0.46), rgba(18, 28, 39, 0.4)) !important;
}

.telegram-list-item.has-dialog {
  background: linear-gradient(180deg, rgba(25, 38, 53, 0.42), rgba(15, 24, 34, 0.36)) !important;
}

.telegram-list-item.has-dialog .chat-list-name {
  color: #f2f7ff;
}

.telegram-list-item.has-dialog .chat-list-time {
  color: #b6c7da;
}

.telegram-list-item.has-dialog .chat-list-preview {
  color: #b3c3d6;
}

.telegram-list-item.active-chat {
  background: linear-gradient(180deg, rgba(69, 109, 154, 0.72), rgba(34, 54, 79, 0.84)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03) !important;
}

.telegram-list-item.pinned-chat {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.015) !important;
}

.sidebar-item-menu {
  min-width: 180px;
}

.sidebar-drag-handle {
  width: 26px;
  height: 38px;
  flex: 0 0 26px;
  margin-left: 8px;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: grab;
  padding: 0;
  opacity: 0.72;
}

.sidebar-drag-handle span {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: rgba(205, 223, 242, 0.8);
}

.sidebar-drag-handle:active {
  cursor: grabbing;
}

.sidebar-pin-slot {
  width: 28px;
  height: 38px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  opacity: 0.72;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
}

.sidebar-pin-slot.is-visible {
  opacity: 1;
}

.sidebar-pin-slot:hover {
  background: rgba(255,255,255,0.04);
}

.sidebar-pin-icon {
  width: 13px;
  height: 13px;
  display: block;
  fill: rgba(210, 216, 224, 0.72);
  transform: rotate(-18deg);
  filter: none;
}

.sidebar-pin-slot.is-visible .sidebar-pin-icon {
  fill: rgba(255, 96, 96, 0.94);
}

.sidebar-drag-placeholder {
  border-radius: 22px !important;
  background: linear-gradient(180deg, rgba(92, 131, 184, 0.08), rgba(92, 131, 184, 0.03)) !important;
  border: 1px dashed rgba(138, 178, 224, 0.18) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03) !important;
  min-height: 74px;
}

.telegram-list-item.dragging {
  opacity: 0.98;
  border-color: transparent !important;
  box-shadow: 0 10px 24px rgba(8, 16, 28, 0.22) !important;
  transition: none !important;
}

.contact-empty,
.group-empty {
  justify-content: center;
  color: #97aabc;
  font-size: 14px;
}

.chat-list-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(86, 128, 186, 0.38), rgba(33, 58, 91, 0.68));
  color: #eef6ff;
  font-size: 19px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.24);
}

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

.chat-list-avatar.group-avatar {
  background: linear-gradient(180deg, rgba(97, 73, 156, 0.54), rgba(50, 31, 101, 0.8));
}

.group-avatar-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px;
}

.group-avatar-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: radial-gradient(circle at 50% 30%, rgba(109, 166, 235, 0.22), rgba(10, 16, 24, 0.9));
  box-shadow: inset 0 0 18px rgba(0,0,0,0.34);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #dcecff;
  font-size: 28px;
}

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

.group-avatar-upload-btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.avatar {
  overflow: hidden;
}

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

.profile-avatar-upload-trigger {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.profile-avatar-upload-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.group-edit-meta {
  margin-top: 12px;
  color: #92a9c3;
  font-size: 13px;
  line-height: 1.5;
}

.profile-panel {
  margin: 18px 18px 0;
  padding: 18px;
  border-radius: 20px;
  min-height: 260px;
}

.profile-panel-modal {
  position: fixed;
  inset: 0;
  z-index: 14000;
  margin: 0;
  padding: 0;
  min-height: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.profile-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 18, 0.62);
  backdrop-filter: blur(6px);
}

.profile-panel-window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(12, 20, 30, 0.98), rgba(8, 14, 22, 0.98));
  box-shadow: 0 28px 90px rgba(0,0,0,0.46);
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 154, 189, 0.28) transparent;
  scrollbar-gutter: stable;
}

.profile-panel-window::-webkit-scrollbar {
  width: 10px;
}

.profile-panel-window::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(124, 154, 189, 0.28);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.profile-panel-window::-webkit-scrollbar-track {
  background: transparent;
}

.guard-panel-modal {
  z-index: 14500;
}

.guard-panel-window {
  width: min(820px, calc(100vw - 32px));
  background:
    radial-gradient(circle at top center, rgba(74, 132, 201, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(16, 27, 40, 0.98), rgba(7, 13, 21, 0.98));
}

.guard-panel-window::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(133, 196, 255, 0.08), transparent 28%),
    radial-gradient(circle at 85% 18%, rgba(88, 147, 217, 0.10), transparent 18%);
}

.guard-panel-window > * {
  position: relative;
  z-index: 1;
}

.guard-panel-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(123, 181, 241, 0.14);
  background:
    linear-gradient(180deg, rgba(18, 30, 45, 0.84), rgba(10, 17, 27, 0.86));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 16px 36px rgba(0,0,0,0.16);
}

.guard-panel-card + .guard-panel-card {
  margin-top: 14px;
}

.guard-panel-card .profile-settings-head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #eef6ff;
}

.guard-panel-card .profile-settings-head::before {
  content: "";
  width: 18px;
  height: 20px;
  flex: 0 0 auto;
  clip-path: polygon(50% 0%, 92% 16%, 92% 60%, 50% 100%, 8% 60%, 8% 16%);
  background: linear-gradient(180deg, rgba(110, 188, 255, 0.96), rgba(37, 103, 181, 0.92));
  box-shadow: 0 8px 18px rgba(39, 105, 178, 0.22);
}

.guard-config-input {
  min-height: 220px;
  max-height: 360px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(124, 177, 235, 0.14);
  background: rgba(5, 11, 18, 0.88);
  color: #e8f3ff;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}

.guard-config-input:focus {
  outline: none;
  border-color: rgba(117, 187, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(88, 158, 226, 0.10);
}

.guard-tunnel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.guard-tunnel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 181, 241, 0.12);
  background:
    linear-gradient(180deg, rgba(16, 25, 38, 0.88), rgba(8, 14, 22, 0.88));
  transition: transform 0.16s ease, border-color 0.18s ease, background 0.18s ease;
}

.guard-tunnel-item:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 194, 255, 0.25);
  background:
    linear-gradient(180deg, rgba(18, 31, 46, 0.92), rgba(9, 16, 26, 0.92));
}

.guard-tunnel-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guard-tunnel-name {
  font-size: 15px;
  font-weight: 700;
  color: #f0f7ff;
}

.guard-tunnel-sub {
  color: #9db1c6;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.guard-tunnel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-panel-header {
  margin-bottom: 16px;
}

.profile-panel-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #eef6ff;
}

.profile-telegram-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-telegram-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 22px 20px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.05);
  background: linear-gradient(180deg, rgba(16, 24, 35, 0.78), rgba(10, 16, 24, 0.84));
  box-shadow: none;
  position: relative;
  text-align: center;
  overflow: visible;
}

.profile-telegram-identity {
  min-width: 0;
  width: 100%;
  padding-top: 0;
}

.profile-telegram-name {
  font-size: 24px;
  font-weight: 800;
  color: #eef6ff;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.profile-telegram-handle {
  margin-top: 5px;
  color: #7fb4ee;
  font-size: 15px;
  font-weight: 700;
}

.profile-telegram-subtitle {
  margin: 8px auto 0;
  color: #95a8bf;
  font-size: 13px;
  line-height: 1.45;
  max-width: 360px;
}

.profile-telegram-list {
  display: grid;
  gap: 10px;
}

.profile-settings-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.05);
  background: linear-gradient(180deg, rgba(15, 22, 33, 0.74), rgba(10, 16, 24, 0.8));
  box-shadow: none;
  position: relative;
}

.profile-group-create-card {
  border-color: rgba(123, 181, 241, 0.08);
}

.profile-action-row {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.profile-action-row-danger .profile-action-title,
.profile-action-row-danger .profile-action-subtitle {
  color: #ffc4cd;
}

.profile-action-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-action-title {
  color: #eef6ff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.profile-action-subtitle {
  color: #8fa4bb;
  font-size: 13px;
  line-height: 1.35;
}

.profile-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(49, 94, 149, 0.86), rgba(27, 58, 94, 0.92));
  color: #eef6ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.profile-action-icon-danger {
  background: linear-gradient(180deg, rgba(124, 47, 63, 0.86), rgba(74, 26, 38, 0.92));
}

.profile-action-icon-symbol {
  font-size: 22px;
  line-height: 1;
  font-weight: 500;
  transform: translateY(-1px);
}

.profile-action-chevron {
  color: #7c91a9;
  font-size: 24px;
  line-height: 1;
  flex: 0 0 auto;
}

.profile-create-group-trigger:hover .profile-action-chevron {
  color: #a8c8ea;
}

.profile-inline-sheet {
  padding: 8px !important;
  display: grid;
  gap: 2px;
}

.profile-inline-sheet .profile-action-row {
  padding: 10px 8px;
  border-radius: 14px;
}

.profile-inline-sheet .profile-action-row:hover {
  background: rgba(255,255,255,0.03);
}

.profile-media-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.profile-media-section .profile-action-row {
  display: none;
}

.profile-media-add {
  border: 1px dashed rgba(126, 180, 238, 0.22);
  background: linear-gradient(180deg, rgba(18, 29, 43, 0.82), rgba(9, 15, 23, 0.9));
  display: grid;
  place-items: center;
}

.profile-media-add-inner {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px;
}

.profile-media-add-plus {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(49, 94, 149, 0.9), rgba(27, 58, 94, 0.96));
  color: #eef6ff;
  font-size: 24px;
  line-height: 1;
}

.profile-media-add-text {
  color: #9eb2c7;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.profile-media-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(6, 12, 19, 0.9);
  cursor: pointer;
}

.profile-media-item-large {
  grid-column: span 2;
  grid-row: span 2;
}

.profile-media-item img,
.profile-media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-media-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.28));
  pointer-events: none;
}

.profile-media-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 14, 22, 0.78);
  border: 1px solid rgba(255,255,255,0.08);
  color: #eef6ff;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.profile-group-create-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.profile-group-create-row > div {
  min-width: 0;
  flex: 1;
}

.profile-group-create-sub {
  margin-top: 4px;
  color: #8fa4bb;
  font-size: 13px;
  line-height: 1.4;
}

.profile-group-create-card .profile-settings-head {
  margin-bottom: 0;
}

.profile-group-creator {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.profile-settings-head {
  margin-bottom: 10px;
  color: #eef6ff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.profile-settings-head::after {
  display: none;
}

.profile-settings-card .profile-label {
  font-size: 12px;
  margin-bottom: 7px;
  color: #8ea4bc;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-settings-card .profile-input + .profile-label {
  margin-top: 14px;
}

.profile-settings-card .profile-input {
  padding: 13px 14px;
  border-radius: 14px;
  font-size: 15px;
  background: rgba(5, 11, 18, 0.88);
}

.profile-settings-card .profile-actions {
  margin-top: 14px;
}

.profile-settings-card-danger .profile-settings-head {
  color: #ffd3da;
}

.profile-avatar-large-wrap {
  width: 88px;
  height: 88px;
}

.profile-avatar-large-wrap-hero {
  width: 118px;
  height: 118px;
  position: relative;
  flex: 0 0 118px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  margin-bottom: 6px;
  z-index: 1;
}

.profile-avatar-large,
.profile-avatar-large-fallback {
  width: 88px;
  height: 88px;
}

.profile-avatar-large-wrap-hero .profile-avatar-large,
.profile-avatar-large-wrap-hero .profile-avatar-large-fallback {
  width: 118px;
  height: 118px;
}

.profile-avatar-large-wrap-hero .profile-avatar-large-fallback .profile-avatar-emblem {
  width: 52px;
  height: 52px;
}

.profile-avatar-large-wrap-hero .profile-avatar-large-fallback .profile-avatar-emblem span {
  width: 10px;
  height: 30px;
  top: 7px;
}

.profile-avatar-large-wrap-hero .profile-avatar-large-fallback .profile-avatar-emblem span:nth-child(1) {
  left: 6px;
}

.profile-avatar-large-wrap-hero .profile-avatar-large-fallback .profile-avatar-emblem span:nth-child(2) {
  left: 20px;
}

.profile-avatar-large-wrap-hero .profile-avatar-large-fallback .profile-avatar-emblem span:nth-child(3) {
  left: 34px;
}

.profile-avatar-large-wrap-hero .profile-avatar-large-fallback .profile-avatar-emblem b {
  font-size: 14px;
  bottom: 3px;
}

.profile-avatar-edit-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #284765, #182c43);
  color: #eef6ff;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 18px rgba(0,0,0,0.24);
  font-size: 15px;
}

.profile-settings-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  margin-left: 0;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #eef6ff;
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.15s ease, border-color 0.2s ease, opacity 0.2s ease;
  flex: 0 0 auto;
}

.profile-settings-toggle:hover {
  opacity: 0.96;
  border-color: rgba(118, 199, 255, 0.24);
}

.profile-settings-toggle.active {
  background: linear-gradient(180deg, rgba(64, 105, 154, 0.88), rgba(28, 59, 96, 0.9));
}

.avatar-upload-btn,
.logout-btn {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  min-height: 42px;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: center;
}

.profile-actions .avatar-upload-btn,
.profile-actions .logout-btn {
  margin-left: 0;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.nav-btn-guard:hover .guard-nav-icon::before,
.nav-btn-guard:focus-visible .guard-nav-icon::before {
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.16)) brightness(1.03);
}

@media (max-width: 900px) {
  .profile-panel-backdrop {
    background: rgba(4, 9, 16, 0.82);
    backdrop-filter: blur(10px);
  }

  .profile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }

  .profile-panel-title {
    min-width: 0;
    flex: 1;
    font-size: 15px;
    line-height: 1.25;
  }

  .profile-telegram-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 12px;
    border-radius: 20px;
    border-color: rgba(255,255,255,0.05);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  }

  .profile-panel-window {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: none;
    width: auto;
    max-height: none;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
    border-radius: 0;
    border: none;
    box-shadow: none;
    background:
      radial-gradient(circle at top center, rgba(73, 129, 188, 0.12), transparent 24%),
      linear-gradient(180deg, rgba(10, 16, 24, 0.985), rgba(7, 12, 20, 0.99));
    overflow-x: hidden;
  }

  .guard-panel-window {
    width: calc(100vw - 14px);
    max-height: calc(100vh - 14px);
    padding: 14px;
  }

  .profile-group-create-row {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-group-create-row .logout-btn {
    width: 100%;
  }

  .profile-telegram-name {
    font-size: 17px;
  }

  .profile-telegram-handle {
    font-size: 13px;
  }

  .profile-telegram-subtitle,
  .profile-group-create-sub {
    font-size: 12px;
  }

  .profile-telegram-subtitle {
    max-width: none;
  }

  .profile-telegram-identity {
    padding-top: 0;
  }

  .profile-telegram-card {
    gap: 10px;
  }

  .profile-telegram-list {
    gap: 10px;
  }

  .profile-settings-card {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.05);
    background: linear-gradient(180deg, rgba(16, 24, 35, 0.9), rgba(11, 18, 27, 0.92));
    box-shadow: none;
  }

  .profile-settings-head {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .profile-settings-head::after {
    width: 28px;
    margin-top: 8px;
  }

  .profile-actions {
    grid-template-columns: 1fr;
  }

  .profile-settings-card .profile-input {
    padding: 12px 13px;
    border-radius: 14px;
  }

  .profile-avatar-large-wrap-hero {
    width: 84px;
    height: 84px;
    flex-basis: 84px;
  }

  .profile-avatar-large-wrap-hero .profile-avatar-large,
  .profile-avatar-large-wrap-hero .profile-avatar-large-fallback {
    width: 84px;
    height: 84px;
  }

  .profile-avatar-edit-badge {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .profile-settings-toggle {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 15px;
  }

  .profile-actions .avatar-upload-btn,
  .profile-actions .logout-btn,
  .profile-group-create-row .logout-btn {
    min-height: 46px;
    border-radius: 14px;
  }

  .guard-panel-card {
    padding: 14px;
    border-radius: 16px;
  }

  .guard-tunnel-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .guard-tunnel-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .guard-config-input {
    min-height: 180px;
  }
}

@media (max-width: 900px) {
  body {
    display: block;
    min-height: 100dvh;
    padding: 0;
    background:
      radial-gradient(circle at top center, rgba(73, 125, 182, 0.16), transparent 34%),
      linear-gradient(180deg, #0b1118 0%, #05080d 100%);
  }

  .app {
    width: 100vw;
    min-height: 100dvh;
    gap: 0;
    grid-template-columns: 1fr;
  }

  .phone {
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .sidebar,
  .chat-screen {
    width: 100vw;
    max-width: 100vw;
  }

  .sidebar {
    display: block;
  }

  .chat-screen {
    display: none;
  }

  .app.mobile-chat-open .sidebar {
    display: none;
  }

  .app.mobile-chat-open .chat-screen {
    display: flex;
  }

  .sidebar-header {
    padding: 14px 16px 10px;
  }

  .logo-wrap {
    width: 52px;
    height: 52px;
    margin: 0 0 8px;
  }

  .contacts,
  .chats {
    padding: 0 16px;
  }

  .section-title {
    margin: 10px 0 10px;
    font-size: 13px;
  }

  .user-search-box {
    gap: 8px;
    margin: 6px 0 10px;
  }

  .user-search-box input,
  .user-search-box button {
    height: 40px;
    font-size: 14px;
  }

  .user-search-box button {
    padding-inline: 12px;
    white-space: nowrap;
  }

  .sidebar-tabs {
    margin: 6px 0 10px;
    padding: 4px;
    border-radius: 13px;
  }

  .sidebar-tab {
    min-height: 38px;
    font-size: 13px;
  }

  .sidebar-scroll-area {
    padding-bottom: 12px;
  }

  .chat-top {
    padding: 14px 16px;
    min-height: 74px;
  }

  .left-head {
    gap: 12px;
    min-width: 0;
  }

  .back {
    width: 34px;
    height: 34px;
    font-size: 30px;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
  }

  .avatar {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .name {
    font-size: 20px;
  }

  .sub {
    font-size: 13px;
  }

  .messages {
    min-height: 0;
  }

  .composer {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .media-btn {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
  }

  .input-shell {
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 22px;
  }

  .message-input {
    font-size: 16px;
  }

  .composer-picker-btn {
    width: 34px;
    height: 34px;
  }

  .media-picker-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    display: grid;
    position: sticky;
    bottom: 0;
    z-index: 20;
    height: calc(66px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app.mobile-chat-open .bottom-nav {
    display: none;
  }

  .group-menu,
  .group-members-picker,
  .profile-panel,
  .current-user-box {
    margin-left: 12px !important;
    margin-right: 12px !important;
  }

  .guard-panel-window {
    width: calc(100vw - 10px);
    max-height: calc(100dvh - 10px);
    padding: 12px;
    border-radius: 16px;
  }

  .guard-panel-card .profile-settings-head {
    font-size: 13px;
  }

  .guard-panel-card .profile-group-create-sub {
    line-height: 1.45;
  }

  .guard-config-input {
    min-height: 150px;
    max-height: 240px;
    font-size: 12px;
  }

  .guard-tunnel-name {
    font-size: 14px;
  }

  .guard-tunnel-sub {
    font-size: 11px;
  }
}

.chat-list-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.chat-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-list-name {
  flex: 1;
  min-width: 0;
  color: #eef6ff;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-time {
  color: #9eb0c4;
  font-size: 12px;
  flex: 0 0 auto;
}

.chat-list-preview {
  flex: 1;
  min-width: 0;
  color: #9eb0c4;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#contactsList .unread-badge,
#groupsList .unread-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #74c4ff;
  color: #07131f;
  font-size: 12px;
  font-weight: 800;
}

#editMessageModal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 12000 !important;
}

#editMessageModal .members-modal-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(2, 8, 18, 0.58) !important;
  backdrop-filter: blur(6px) !important;
}

#editMessageModal .members-modal-card.edit-message-card {
  position: fixed !important;
  top: 16px !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  width: min(520px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  max-height: calc(100vh - 32px) !important;
  margin: 0 !important;
  border-radius: 22px !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  background: linear-gradient(180deg, rgba(16, 26, 40, 0.98), rgba(7, 14, 24, 0.98)) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,0.45) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

#editMessageModal .edit-message-body {
  padding: 16px !important;
  box-sizing: border-box !important;
  max-height: calc(100vh - 140px) !important;
  overflow-y: auto !important;
}

#editMessageModal .edit-message-textarea {
  width: 100% !important;
  min-height: 110px !important;
  max-height: 180px !important;
  resize: vertical !important;
  padding: 14px 16px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  background: rgba(7, 14, 22, 0.92) !important;
  color: #eef6ff !important;
  font-size: 15px !important;
  outline: none !important;
  box-sizing: border-box !important;
}

#editMessageModal .edit-message-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin-top: 14px !important;
  flex-wrap: wrap !important;
}

@media (max-width: 640px) {
  #editMessageModal .members-modal-card.edit-message-card {
    top: 10px !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 20px) !important;
    border-radius: 18px !important;
  }

  #editMessageModal .edit-message-body {
    max-height: calc(100vh - 120px) !important;
    padding: 14px !important;
  }

  #editMessageModal .edit-message-textarea {
    min-height: 96px !important;
    max-height: 150px !important;
  }
}

/* Adaptive sizing layer */
@media (min-width: 901px) {
  .app {
    width: min(1560px, calc(100vw - 32px));
    grid-template-columns: clamp(320px, 28vw, 420px) minmax(0, 1fr);
    gap: clamp(14px, 1.6vw, 24px);
  }

  .phone,
  .chat-screen {
    height: clamp(720px, calc(100vh - 48px), 940px);
    min-height: clamp(720px, calc(100vh - 48px), 940px);
  }

  .sidebar-header {
    padding: clamp(18px, 2vw, 34px) clamp(18px, 2vw, 26px) clamp(14px, 1.6vw, 18px);
  }

  .contacts,
  .chats {
    padding: 0 clamp(16px, 2vw, 26px);
  }

  .logo-wrap {
    width: clamp(52px, 4.6vw, 64px);
    height: clamp(52px, 4.6vw, 64px);
    margin-bottom: 10px;
  }

  .logo-mark {
    width: clamp(34px, 2.9vw, 44px);
    height: clamp(34px, 2.9vw, 44px);
  }

  .chat-top {
    padding: clamp(16px, 1.8vw, 24px) clamp(16px, 1.8vw, 24px) clamp(14px, 1.4vw, 18px);
    min-height: clamp(74px, 8vw, 94px);
  }

  .avatar {
    width: clamp(48px, 4.5vw, 62px);
    height: clamp(48px, 4.5vw, 62px);
    font-size: clamp(20px, 2vw, 28px);
  }

  .name {
    font-size: clamp(20px, 2vw, 26px);
  }

  .sub {
    font-size: clamp(13px, 1.1vw, 15px);
  }

  .messages {
    padding: clamp(16px, 1.8vw, 24px);
    gap: clamp(12px, 1.4vw, 18px);
  }

  .bubble {
    max-width: min(68%, 720px);
    padding: clamp(12px, 1.2vw, 16px) clamp(14px, 1.4vw, 18px);
    font-size: clamp(15px, 1.2vw, 18px);
  }

  .composer {
    padding: clamp(12px, 1.4vw, 18px) clamp(14px, 1.6vw, 22px) clamp(14px, 1.6vw, 22px);
    gap: clamp(10px, 1.1vw, 14px);
  }

  .message-input {
    font-size: clamp(15px, 1.2vw, 18px);
  }

  .media-btn,
  .send {
    width: clamp(42px, 3.8vw, 52px);
    height: clamp(42px, 3.8vw, 52px);
    font-size: clamp(18px, 1.8vw, 22px);
  }

  .attach-btn {
    width: clamp(40px, 3.4vw, 46px);
    height: clamp(40px, 3.4vw, 46px);
  }

  .attach-icon {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 900px) {
  .phone,
  .chat-screen,
  .sidebar {
    height: 100dvh;
    min-height: 100dvh;
  }

  .messages {
    padding: 14px;
    gap: 12px;
  }

  .bubble {
    max-width: 84%;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.4;
  }

  .chat-list-name {
    font-size: 15px;
  }

  .chat-list-preview {
    font-size: 12px;
  }

  .chat-list-time {
    font-size: 12px;
  }

  .telegram-list-item {
    padding: 12px 10px;
    gap: 10px;
  }
}

@media (max-width: 640px) {
  .voice-note {
    min-width: 0;
    width: min(100%, 232px);
    max-width: min(100%, 232px);
    gap: 10px;
    padding: 10px 12px;
  }

  .voice-play-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    font-size: 18px;
  }

  .voice-wave {
    height: 24px;
    gap: 2px;
  }

  .voice-wave-bar {
    width: 3px;
  }

  .voice-note-meta {
    margin-top: 5px;
    gap: 8px;
    font-size: 12px;
  }

  .voice-note-duration {
    font-size: 12px;
  }

  .voice-note-badge {
    font-size: 10px;
  }

  .bubble-audio {
    width: min(100%, 232px);
  }

  .sidebar-header {
    padding: 12px 14px 8px;
  }

  .logo-wrap {
    width: 58px;
    height: 58px;
    margin: 0 0 6px;
    border-width: 1px;
    padding-top: 2px;
  }

  .logo {
    font-size: 26px;
  }

  .logo-mark {
    width: 38px;
    height: 38px;
  }

  .logo-mark span {
    width: 7px;
    height: 22px;
    top: 6px;
  }

  .logo-mark span:nth-child(1) {
    left: 5px;
  }

  .logo-mark span:nth-child(2) {
    left: 15px;
  }

  .logo-mark span:nth-child(3) {
    left: 25px;
  }

  .logo-mark b {
    font-size: 11px;
    bottom: 3px;
  }

  .contacts,
  .chats {
    padding: 0 12px;
  }

  .user-search-box {
    gap: 8px;
  }

  .sidebar-tabs {
    margin: 6px 0 10px;
    padding: 4px;
    border-radius: 12px;
  }

  .sidebar-tab {
    height: 36px;
    min-height: 36px;
    border-radius: 10px;
    font-size: 13px;
    padding: 0 8px;
  }

  .user-search-box input,
  .user-search-box button {
    height: 38px;
  }

  .chat-top {
    padding: 12px 12px 10px;
    min-height: 68px;
    gap: 10px;
  }

  .left-head {
    flex: 1;
    gap: 10px;
    min-width: 0;
  }

  .left-head > div:last-child {
    min-width: 0;
    flex: 1;
  }

  .name {
    font-size: 18px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sub {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-actions {
    gap: 8px;
    flex: 0 0 auto;
  }

  .top-btn,
  .top-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 18px;
  }

  .avatar {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .composer {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    gap: 8px;
    align-items: center;
  }

  .input-shell {
    min-height: 46px;
    padding: 11px 72px 11px 0;
    display: flex;
    align-items: center;
  }

  .message-input {
    font-size: 16px;
    line-height: 1.35;
    max-height: 120px;
  }

  .composer-picker-btn {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .composer-icon {
    width: 17px;
    height: 17px;
  }

  #encryptToggleButton {
    right: 42px;
  }

  #mediaPickerButton {
    right: 6px;
  }

  .media-btn,
  .send {
    width: 46px;
    height: 46px;
    font-size: 22px;
    flex: 0 0 46px;
  }

  .attach-btn {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .attach-icon {
    width: 20px;
    height: 20px;
  }

  .bubble {
    max-width: 88%;
    font-size: 14px;
  }

  .reply-preview-bar {
    margin: 0 10px 8px;
    padding: 8px 10px 8px 12px;
    border-radius: 12px;
  }

  .pending-image-preview-bar {
    margin: 0 10px 8px;
    padding: 8px 10px;
    border-radius: 12px;
    gap: 10px;
    align-items: center;
  }

  .edit-composer-bar {
    margin: 0 10px 8px;
    padding: 8px 10px 8px 12px;
    border-radius: 14px;
  }

  .edit-composer-title {
    font-size: 13px;
  }

  .edit-composer-subtitle {
    font-size: 12px;
  }

  .edit-composer-bar .reply-preview-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .pending-image-preview-thumb {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 10px;
  }

  .pending-image-preview-title {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pending-image-preview-sub {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pending-image-preview-bar .reply-preview-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .reply-preview-author {
    font-size: 12px;
  }

  .reply-preview-message {
    font-size: 12px;
  }

  .voice-record-status {
    min-width: 0;
    flex: 1;
    height: 46px;
    padding: 0 14px;
    font-size: 13px;
  }

  .media-picker-panel {
    right: 10px;
    left: 10px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    border-radius: 16px;
  }

  .image-preview-card {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 20px !important;
    background: rgba(10, 16, 24, 0.72);
  }

  .image-preview-body {
    padding: 8px 10px 0;
  }

  .image-preview-large {
    max-height: calc(100dvh - 160px);
    border-radius: 18px;
  }

  #imagePreviewModal .members-modal-header {
    padding: 10px 10px 0;
  }

  .image-preview-actions {
    padding: 10px 10px 12px;
  }
}

@media (max-width: 900px) {
  .profile-panel.profile-panel-modal {
    margin: 0 !important;
  }

  .profile-panel.profile-panel-modal .profile-panel-backdrop {
    background: rgba(4, 9, 16, 0.84) !important;
    backdrop-filter: blur(10px) !important;
  }

  .profile-panel.profile-panel-modal .profile-panel-window {
    position: absolute !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)) !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    overflow-x: hidden !important;
    background:
      radial-gradient(circle at top center, rgba(73, 129, 188, 0.12), transparent 24%),
      linear-gradient(180deg, rgba(10, 16, 24, 0.985), rgba(7, 12, 20, 0.99)) !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(124, 154, 189, 0.22) transparent !important;
  }

  .profile-panel.profile-panel-modal .profile-panel-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
  }

  .profile-panel.profile-panel-modal .profile-panel-title {
    min-width: 0 !important;
    flex: 1 !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-card,
  .profile-panel.profile-panel-modal .profile-telegram-list {
    gap: 10px !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-top {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 24px 16px 14px !important;
    border-radius: 18px !important;
    border: 1px solid rgba(255,255,255,0.04) !important;
    background:
      linear-gradient(180deg, rgba(17, 24, 35, 0.72), rgba(11, 17, 26, 0.76)) !important;
    box-shadow: none !important;
    text-align: center !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-identity {
    padding-top: 0 !important;
    width: 100% !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-name {
    font-size: 19px !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-handle {
    font-size: 13px !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-subtitle,
  .profile-panel.profile-panel-modal .profile-group-create-sub {
    font-size: 12px !important;
    max-width: none !important;
  }

  .profile-panel.profile-panel-modal .profile-avatar-large-wrap-hero {
    width: 96px !important;
    height: 96px !important;
    flex: 0 0 96px !important;
    margin-bottom: 4px !important;
  }

  .profile-panel.profile-panel-modal .profile-avatar-large-wrap-hero .profile-avatar-large,
  .profile-panel.profile-panel-modal .profile-avatar-large-wrap-hero .profile-avatar-large-fallback {
    width: 96px !important;
    height: 96px !important;
  }

  .profile-panel.profile-panel-modal .profile-avatar-edit-badge {
    width: 30px !important;
    height: 30px !important;
    font-size: 13px !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-toggle {
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 13px !important;
    font-size: 14px !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-card {
    padding: 14px !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255,255,255,0.04) !important;
    background: linear-gradient(180deg, rgba(15, 22, 33, 0.72), rgba(10, 16, 24, 0.78)) !important;
    box-shadow: none !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-head {
    font-size: 16px !important;
    margin-bottom: 10px !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-head::after {
    display: none !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-card .profile-input {
    padding: 12px 13px !important;
    border-radius: 14px !important;
    background: rgba(5, 11, 18, 0.88) !important;
  }

  .profile-panel.profile-panel-modal .profile-group-create-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .profile-panel.profile-panel-modal .profile-action-title {
    font-size: 15px !important;
  }

  .profile-panel.profile-panel-modal .profile-action-subtitle {
    font-size: 12px !important;
  }

  .profile-panel.profile-panel-modal .profile-actions {
    grid-template-columns: 1fr !important;
  }

  .profile-panel.profile-panel-modal .profile-actions .avatar-upload-btn,
  .profile-panel.profile-panel-modal .profile-actions .logout-btn,
  .profile-panel.profile-panel-modal .profile-group-create-row .logout-btn {
    width: 100% !important;
    min-height: 46px !important;
    border-radius: 14px !important;
  }

  .profile-panel.profile-panel-modal .profile-media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .profile-panel.profile-panel-modal .profile-media-item-large {
    grid-column: span 2;
    grid-row: span 2;
  }
}

@media (max-width: 640px) {
  .profile-panel.profile-panel-modal .profile-panel-window {
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom)) !important;
  }

  .profile-panel.profile-panel-modal .profile-panel-header {
    margin-bottom: 10px !important;
  }

  .profile-panel.profile-panel-modal .top-icon-btn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 14px !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-top {
    gap: 8px !important;
    padding: 20px 12px 14px !important;
    border-radius: 18px !important;
  }

  .profile-panel.profile-panel-modal .profile-avatar-large-wrap-hero {
    width: 84px !important;
    height: 84px !important;
    flex: 0 0 84px !important;
  }

  .profile-panel.profile-panel-modal .profile-avatar-large-wrap-hero .profile-avatar-large,
  .profile-panel.profile-panel-modal .profile-avatar-large-wrap-hero .profile-avatar-large-fallback {
    width: 84px !important;
    height: 84px !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-name {
    font-size: 17px !important;
    line-height: 1.15 !important;
  }

  .profile-panel.profile-panel-modal .profile-telegram-handle,
  .profile-panel.profile-panel-modal .profile-telegram-subtitle,
  .profile-panel.profile-panel-modal .profile-group-create-sub,
  .profile-panel.profile-panel-modal .profile-settings-card .profile-label,
  .profile-panel.profile-panel-modal .profile-action-subtitle {
    font-size: 11px !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-card {
    padding: 10px !important;
    border-radius: 16px !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-head {
    font-size: 15px !important;
    margin-bottom: 8px !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-card .profile-input {
    padding: 11px 12px !important;
    font-size: 15px !important;
  }

  .profile-panel.profile-panel-modal .profile-actions {
    gap: 8px !important;
  }

  .profile-panel.profile-panel-modal .profile-actions .avatar-upload-btn,
  .profile-panel.profile-panel-modal .profile-actions .logout-btn,
  .profile-panel.profile-panel-modal .profile-group-create-row .logout-btn {
    min-height: 44px !important;
    font-size: 14px !important;
  }

  .profile-panel.profile-panel-modal .profile-media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-media-item {
    border-radius: 14px;
  }

  .profile-media-item-large {
    grid-column: span 2;
    grid-row: span 2;
  }

  .profile-panel.profile-panel-modal .profile-action-icon {
    width: 36px !important;
    height: 36px !important;
    border-radius: 12px !important;
    flex: 0 0 36px !important;
  }

  .profile-panel.profile-panel-modal .profile-action-title {
    font-size: 14px !important;
    line-height: 1.2 !important;
  }

  .profile-panel.profile-panel-modal .profile-action-subtitle {
    line-height: 1.25 !important;
  }

  .profile-panel.profile-panel-modal .profile-settings-toggle {
    display: none !important;
  }

  .profile-panel.profile-panel-modal .profile-action-row {
    min-height: 52px !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 4px 2px !important;
  }

  .profile-panel.profile-panel-modal .profile-inline-sheet {
    padding: 8px !important;
  }

  .profile-panel.profile-panel-modal .profile-inline-sheet .profile-action-row {
    padding: 10px 8px !important;
    border-radius: 14px !important;
  }

  .profile-panel.profile-panel-modal .profile-action-copy {
    gap: 3px !important;
    justify-content: center !important;
    min-height: 36px !important;
    padding-top: 0 !important;
  }

  .profile-panel.profile-panel-modal .profile-action-chevron {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 36px !important;
    margin-left: 4px !important;
    font-size: 22px !important;
  }

  .profile-panel.profile-panel-modal.profile-mobile-editing .profile-telegram-list > .profile-settings-card:not(#profileSettingsMenu) {
    display: none !important;
  }

  .profile-panel.profile-panel-modal.profile-mobile-grouping .profile-telegram-list > .profile-settings-card:not(.profile-group-create-card) {
    display: none !important;
  }

  .profile-panel.profile-panel-modal.profile-mobile-editing .profile-telegram-card,
  .profile-panel.profile-panel-modal.profile-mobile-grouping .profile-telegram-card {
    gap: 12px !important;
  }

  .profile-panel.profile-panel-modal.profile-mobile-editing #profileSettingsMenu,
  .profile-panel.profile-panel-modal.profile-mobile-grouping .profile-group-create-card {
    display: block !important;
    margin-top: 2px !important;
  }
}

#imagePreviewModal .image-preview-body {
  touch-action: pan-y;
}

.profile-settings-card.profile-media-section .profile-action-row {
  display: flex !important;
}

.profile-settings-card.profile-media-section .profile-media-grid {
  display: none !important;
}

.profile-device-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.profile-device-subtitle {
  color: rgba(224, 235, 245, 0.68);
  font-size: 12px;
  line-height: 1.35;
}

.profile-device-card {
  padding: 14px 16px 16px;
}

.profile-device-toolbar-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.profile-device-head {
  margin-bottom: 0;
}

.profile-device-head::after {
  display: none;
}

.profile-device-trash-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(224, 235, 245, 0.76);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.profile-device-trash-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f3f8fd;
}

.profile-device-trash-btn:active {
  transform: translateY(1px);
}

.profile-device-list {
  display: grid;
  gap: 8px;
}

.profile-device-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-device-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.profile-device-title {
  color: #f5fbff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.profile-device-meta,
.profile-device-time {
  color: rgba(224, 235, 245, 0.68);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.profile-device-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(94, 190, 124, 0.16);
  color: #7ce19a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.profile-device-action {
  min-width: 88px;
  padding: 8px 10px;
  font-size: 12px;
}

.profile-device-empty {
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  color: rgba(224, 235, 245, 0.7);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .profile-device-card {
    padding: 12px 12px 14px;
    margin-top: 2px;
  }

  .profile-device-toolbar,
  .profile-device-item {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profile-device-toolbar {
    gap: 8px;
    margin-bottom: 8px;
  }

  .profile-device-toolbar-copy {
    gap: 2px;
    padding-right: 44px;
  }

  .profile-device-head {
    font-size: 14px;
  }

  .profile-device-subtitle {
    font-size: 11px;
    line-height: 1.25;
  }

  .profile-device-trash-btn,
  .profile-device-action {
    min-width: 0;
  }

  .profile-device-trash-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
    justify-self: end;
    margin-top: -40px;
  }

  .profile-device-list {
    gap: 7px;
  }

  .profile-device-item {
    gap: 7px;
    padding: 10px 10px;
    border-radius: 14px;
  }

  .profile-device-copy {
    gap: 3px;
  }

  .profile-device-title {
    font-size: 12px;
    max-width: 100%;
  }

  .profile-device-meta,
  .profile-device-time {
    font-size: 11px;
    line-height: 1.28;
  }

  .profile-device-badge {
    justify-self: start;
    font-size: 9px;
    padding: 3px 7px;
  }

  .profile-device-action {
    width: auto;
    justify-self: start;
    padding: 7px 9px;
    font-size: 11px;
    border-radius: 11px;
  }

  .profile-device-empty {
    padding: 12px 10px;
    border-radius: 14px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .profile-device-card {
    padding: 11px 10px 12px;
  }

  .profile-device-toolbar-copy {
    padding-right: 40px;
  }

  .profile-device-head {
    font-size: 13px;
  }

  .profile-device-subtitle {
    font-size: 10px;
  }

  .profile-device-trash-btn {
    width: 32px;
    height: 32px;
    margin-top: -38px;
  }

  .profile-device-item {
    padding: 9px 9px;
  }
}



