﻿@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Sora:wght@600;700;800&display=swap");

:root {
  --bg: #05060c;
  --bg-soft: #0a0d17;
  --panel: #0e1220;
  --panel-2: #12172a;
  --panel-3: #161d34;
  --text: #eef2ff;
  --muted: #9ca8cf;
  --border: #2b3862;
  --accent-blue: #48b2ff;
  --accent-pink: #ff4fb4;
  --accent-blue-glow: rgba(72, 178, 255, 0.35);
  --accent-pink-glow: rgba(255, 79, 180, 0.3);
  --bubble-me: linear-gradient(145deg, rgba(56, 131, 255, 0.26), rgba(134, 77, 255, 0.18));
  --bubble-peer: linear-gradient(145deg, rgba(255, 79, 180, 0.18), rgba(90, 128, 255, 0.14));
  --danger: #ff5c7d;
  --danger-glow: rgba(255, 92, 125, 0.35);
  --ok: #3ad39f;
  --motion-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-breath: cubic-bezier(0.42, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(90, 170, 255, 0.7) 0%, rgba(255, 96, 184, 0.7) 100%);
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 10% -10%, rgba(72, 178, 255, 0.16), transparent 55%),
    radial-gradient(900px 600px at 105% 10%, rgba(255, 79, 180, 0.15), transparent 58%),
    linear-gradient(180deg, #06070d 0%, #070912 40%, #07080f 100%);
}

#app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.hidden {
  display: none !important;
}

.card {
  background: linear-gradient(180deg, rgba(22, 28, 50, 0.95) 0%, rgba(16, 21, 39, 0.95) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-card {
  width: min(440px, 96vw);
  padding: 24px;
}

h1 {
  margin: 0;
  font-size: 44px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0.015em;
  background: linear-gradient(120deg, #f2f5ff 0%, #98ccff 48%, #ff9ccf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2,
h3 {
  margin: 0;
}

p {
  margin: 8px 0;
}

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

.error {
  color: #ff8fa5;
  margin-top: 8px;
}

.auth-info {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(84, 165, 255, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(27, 40, 72, 0.45) 0%, rgba(16, 24, 44, 0.45) 100%);
}

.verify-resend {
  margin-top: 10px;
}

.tabs {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.stack.tight {
  gap: 8px;
  margin-top: 0;
}

input,
textarea,
button {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  transition:
    transform 0.2s var(--motion-soft),
    box-shadow 0.24s var(--motion-soft),
    border-color 0.24s var(--motion-soft),
    background-color 0.24s var(--motion-soft),
    filter 0.24s var(--motion-soft);
}

input,
textarea {
  background: rgba(12, 16, 29, 0.92);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-out 0s;
  box-shadow: 0 0 0 1000px rgba(12, 16, 29, 0.94) inset;
}

input::placeholder {
  color: #8b98c4;
}

textarea::placeholder {
  color: #8b98c4;
}

textarea {
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
}

input:focus,
textarea:focus,
button:focus {
  outline: none;
  border-color: rgba(86, 170, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(72, 178, 255, 0.18);
}

button {
  position: relative;
  background:
    linear-gradient(135deg, rgba(72, 178, 255, 0.95) 0%, rgba(255, 79, 180, 0.88) 100%);
  color: #fdfdff;
  cursor: pointer;
  will-change: transform, box-shadow;
  transform-origin: center;
  box-shadow:
    0 4px 12px rgba(37, 82, 160, 0.22),
    0 2px 10px rgba(166, 54, 123, 0.18);
  animation: button-idle-breath 2.9s ease-in-out infinite;
}

button::after {
  content: none;
}

button:hover {
  transform: translateY(-0.5px) scale(1.006);
  box-shadow:
    0 7px 16px rgba(56, 120, 220, 0.26),
    0 4px 14px rgba(219, 82, 154, 0.24);
  animation: button-breath 2s ease-in-out infinite;
}

button:active {
  transform: translateY(0) scale(0.996);
  animation: none;
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  animation: none !important;
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
}

button:disabled::after {
  display: none;
}

button.ghost,
.tab {
  background: linear-gradient(180deg, rgba(24, 30, 52, 0.96) 0%, rgba(17, 22, 38, 0.96) 100%);
  animation: button-idle-breath-soft 3.2s ease-in-out infinite;
}

button.ghost:hover,
.tab:hover {
  border-color: rgba(98, 180, 255, 0.65);
  box-shadow: 0 0 14px rgba(72, 178, 255, 0.14);
  animation: button-breath-soft 2.2s ease-in-out infinite;
}

.tab.active {
  border-color: rgba(110, 191, 255, 0.92);
  box-shadow: 0 0 20px rgba(72, 178, 255, 0.26);
  background:
    linear-gradient(135deg, rgba(72, 178, 255, 0.92) 0%, rgba(255, 79, 180, 0.86) 100%);
}

button.danger {
  background: linear-gradient(135deg, #ff5c7d 0%, #ff758f 100%);
  border-color: rgba(255, 124, 156, 0.9);
}

button.danger:hover {
  box-shadow:
    0 6px 14px rgba(255, 103, 139, 0.28),
    0 2px 10px rgba(255, 112, 164, 0.2);
  animation: button-breath 2s ease-in-out infinite;
}

@keyframes button-idle-breath {
  0% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 4px 12px rgba(37, 82, 160, 0.2),
      0 2px 10px rgba(166, 54, 123, 0.15);
  }
  50% {
    transform: translateY(-0.4px) scale(1.006);
    box-shadow:
      0 8px 18px rgba(66, 130, 236, 0.25),
      0 4px 14px rgba(223, 88, 160, 0.22);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 4px 12px rgba(37, 82, 160, 0.2),
      0 2px 10px rgba(166, 54, 123, 0.15);
  }
}

@keyframes button-idle-breath-soft {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 7px rgba(65, 120, 220, 0.12);
  }
  50% {
    transform: translateY(-0.3px) scale(1.004);
    box-shadow: 0 4px 11px rgba(71, 135, 242, 0.18);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 7px rgba(65, 120, 220, 0.12);
  }
}

@keyframes button-breath {
  0% {
    transform: translateY(0) scale(1.003);
  }
  50% {
    transform: translateY(-0.6px) scale(1.008);
  }
  100% {
    transform: translateY(0) scale(1.003);
  }
}

@keyframes button-breath-soft {
  0% {
    transform: translateY(0) scale(1.002);
  }
  50% {
    transform: translateY(-0.4px) scale(1.006);
  }
  100% {
    transform: translateY(0) scale(1.002);
  }
}

#chat-view {
  width: min(1320px, 100%);
  height: min(94vh, 920px);
  display: grid;
  grid-template-columns: 336px 1fr;
  border: 1px solid rgba(73, 100, 168, 0.5);
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(13, 16, 28, 0.96) 0%, rgba(11, 15, 27, 0.96) 100%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
}

.sidebar {
  border-right: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  position: relative;
  background:
    radial-gradient(180px 120px at 90% 2%, rgba(255, 79, 180, 0.12), transparent 70%),
    linear-gradient(180deg, rgba(17, 22, 39, 0.96) 0%, rgba(13, 18, 32, 0.96) 100%);
}

.sidebar::after {
  content: none;
  position: absolute;
  top: 0;
  right: -1px;
  width: 18px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(86, 168, 255, 0.12) 0%, rgba(86, 168, 255, 0.05) 38%, transparent 100%);
}

.me-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(78, 108, 178, 0.24);
}

.me-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.me-user-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.me-user-text > span,
.me-user-text > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(109, 162, 255, 0.55);
  background: linear-gradient(135deg, rgba(56, 129, 241, 0.3), rgba(238, 89, 167, 0.28));
}

.me-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

#me-status {
  font-size: 12px;
  margin-bottom: 4px;
}

#me-handle {
  font-size: 11px;
}

.sidebar-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.sidebar-sections > * {
  flex: 0 0 auto;
}

.collapse-panel {
  flex: 0 0 auto;
  border: 1px solid rgba(70, 99, 165, 0.5);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(17, 24, 44, 0.62) 0%, rgba(13, 18, 34, 0.55) 100%);
  box-shadow: inset 0 1px 0 rgba(140, 179, 255, 0.08);
  overflow: hidden;
}

.collapse-header {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #98aad6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(76, 110, 184, 0.2);
  transition: background-color 0.22s var(--motion-soft), color 0.22s var(--motion-soft);
}

.collapse-header::-webkit-details-marker {
  display: none;
}

.collapse-header::after {
  content: "▾";
  font-size: 11px;
  color: #8fb3f4;
  transform: rotate(0deg);
  transition: transform 0.22s var(--motion-soft), color 0.22s var(--motion-soft);
}

.collapse-panel:not([open]) .collapse-header {
  border-bottom-color: transparent;
}

.collapse-panel:not([open]) .collapse-header::after {
  transform: rotate(-90deg);
  color: #6f7ea8;
}

.collapse-header:hover {
  color: #aecdff;
  background: rgba(33, 47, 85, 0.26);
}

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

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.profile-avatar-upload {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(24, 30, 52, 0.96) 0%, rgba(17, 22, 38, 0.96) 100%);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s var(--motion-soft), box-shadow 0.2s var(--motion-soft);
}

.profile-avatar-upload:hover {
  border-color: rgba(98, 180, 255, 0.65);
  box-shadow: 0 0 10px rgba(72, 178, 255, 0.16);
}

.collapse-panel[data-panel="chats"] .collapse-body {
  padding-top: 6px;
}

.section-header {
  margin-top: 2px;
  margin-bottom: 0;
  font-size: 11px;
  color: #92a3cf;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
  z-index: 1;
}

.search-results,
.conversation-list,
.bots-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: visible;
  min-height: 0;
  padding-right: 0;
}

.invites-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
}

.conversation-list {
  min-height: 0;
  max-height: none;
  flex: 0 0 auto;
  position: relative;
  z-index: 0;
}

.item {
  border: 1px solid #2a3458;
  background: linear-gradient(180deg, rgba(24, 30, 52, 0.95) 0%, rgba(17, 22, 39, 0.95) 100%);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  width: 100%;
  min-width: 0;
  transition:
    border-color 0.24s var(--motion-soft),
    box-shadow 0.24s var(--motion-soft),
    transform 0.24s var(--motion-soft);
}

.item > div:first-child {
  flex: 1;
  min-width: 0;
}

.item-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-user-main {
  flex: 1;
  min-width: 0;
}

.item-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.item > div:first-child > div,
.item > div:first-child > small,
.item-user-main > div,
.item-user-main > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item > div:last-child:not(:first-child) {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 48%;
}

.item button {
  white-space: nowrap;
  flex-shrink: 0;
}

.item:hover {
  transform: translateY(-1px);
  border-color: rgba(86, 168, 255, 0.68);
  box-shadow: 0 6px 20px rgba(72, 178, 255, 0.1);
}

.item.active {
  border-color: rgba(97, 185, 255, 0.95);
  box-shadow:
    0 0 22px rgba(72, 178, 255, 0.16),
    inset 0 0 0 1px rgba(255, 79, 180, 0.2);
}

.item small {
  color: #9ba8ce;
}

.bot-box {
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.public-box {
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding-bottom: 2px;
  background: transparent;
  box-shadow: none;
}

.invite-box {
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.invite-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #8fa2d3;
}

.public-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1 1 auto;
  overflow: visible;
  min-height: 0;
  padding-right: 0;
  max-width: 100%;
}

.public-list .item {
  width: 100%;
  max-width: 100%;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #a9b5d9;
}

.check-line input {
  width: 14px;
  height: 14px;
  padding: 0;
}

.chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  position: relative;
  background:
    radial-gradient(520px 320px at 4% 2%, rgba(72, 178, 255, 0.08), transparent 68%),
    radial-gradient(520px 320px at 98% 0%, rgba(255, 79, 180, 0.08), transparent 68%),
    #090d18;
}

.chat-main::before {
  content: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(95, 150, 255, 0.1) 0%, rgba(95, 150, 255, 0.05) 35%, transparent 100%);
}

.chat-header {
  border-bottom: 1px solid rgba(72, 103, 176, 0.34);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(15, 20, 37, 0.96) 0%, rgba(13, 17, 32, 0.96) 100%);
  box-shadow: inset 0 -1px 0 rgba(79, 118, 205, 0.15);
}

.chat-header h2 {
  margin: 0;
  font-size: 18px;
}

.chat-header p {
  margin: 2px 0 0;
  min-height: 18px;
}

.shortcuts-hint {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.72;
}

.chat-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.messages.dragging {
  outline: 1px dashed rgba(117, 198, 255, 0.7);
  outline-offset: -10px;
}

.message {
  max-width: min(76%, 740px);
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid #2d3a66;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  word-wrap: break-word;
  backdrop-filter: blur(2px);
  position: relative;
}

.message.me {
  align-self: flex-end;
  background: var(--bubble-me);
}

.message.peer {
  align-self: flex-start;
  background: var(--bubble-peer);
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.45;
}

.message-text.deleted {
  color: #9aa6c8;
  font-style: italic;
}

.message-forwarded {
  font-size: 12px;
  color: #9dc6ff;
  margin-bottom: 6px;
}

.reply-preview {
  margin-bottom: 6px;
  padding: 6px 8px;
  border-left: 2px solid rgba(102, 180, 255, 0.75);
  background: rgba(17, 26, 47, 0.7);
  border-radius: 8px;
  font-size: 12px;
  color: #afbedf;
}

.message .meta {
  font-size: 11px;
  color: #97a7ce;
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.message-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.message:hover .message-actions {
  opacity: 1;
  transform: translateY(0);
}

.message-actions button {
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1;
  border-radius: 10px;
  animation: none !important;
}

.message-status {
  color: #a7cbf7;
  border: 1px solid rgba(90, 172, 255, 0.32);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
}

.attachment-line {
  margin-top: 8px;
  border-top: 1px dashed #36436f;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-item {
  border: 1px solid #334069;
  background: rgba(13, 19, 34, 0.68);
  border-radius: 12px;
  padding: 8px;
}

.attachment-label {
  font-size: 12px;
  color: #a8b3d8;
  margin-bottom: 6px;
}

.inline-image,
.inline-video {
  width: min(420px, 100%);
  max-height: 320px;
  border-radius: 10px;
  border: 1px solid #354370;
  background: #090f1e;
  object-fit: cover;
}

.inline-video {
  object-fit: contain;
  background: #0a0e1a;
}

.voice-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(77, 112, 190, 0.45);
  border-radius: 14px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(13, 19, 35, 0.92) 0%, rgba(9, 14, 27, 0.92) 100%);
}

.voice-play {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(97, 153, 255, 0.52);
  background: rgba(22, 36, 67, 0.9);
  color: #dbe8ff;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  animation: none !important;
  box-shadow: none;
}

.voice-play:hover {
  transform: translateY(0) scale(1);
  box-shadow: 0 0 10px rgba(82, 152, 255, 0.24);
}

.voice-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.voice-head {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-pill {
  font-size: 11px;
  color: #b7d8ff;
  border: 1px solid rgba(76, 166, 255, 0.5);
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.voice-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #98aad6;
}

.voice-track-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(82, 157, 255, 0.7) 0%, rgba(79, 114, 214, 0.5) 100%);
  outline: none;
}

.voice-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(201, 226, 255, 0.9);
  background: #d7e9ff;
  box-shadow: 0 0 8px rgba(129, 182, 255, 0.35);
}

.voice-progress::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(201, 226, 255, 0.9);
  background: #d7e9ff;
  box-shadow: 0 0 8px rgba(129, 182, 255, 0.35);
}

.voice-time {
  font-size: 11px;
  color: #9fb0d8;
  white-space: nowrap;
}

.voice-download {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(89, 142, 239, 0.45);
  color: #cbe1ff;
  text-decoration: none;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: rgba(20, 31, 58, 0.82);
}

.voice-download:hover {
  box-shadow: 0 0 10px rgba(92, 162, 255, 0.22);
}

.voice-audio {
  display: none;
}

.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer {
  border-top: 1px solid rgba(72, 103, 176, 0.32);
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto;
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
  background: linear-gradient(180deg, rgba(15, 20, 37, 0.95) 0%, rgba(13, 17, 33, 0.95) 100%);
  box-shadow: inset 0 1px 0 rgba(79, 118, 205, 0.14);
}

.composer-context {
  grid-column: 1 / -1;
  border: 1px solid rgba(80, 117, 196, 0.45);
  border-radius: 12px;
  background: rgba(16, 24, 45, 0.88);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
}

.composer-context-title {
  font-size: 12px;
  color: #b6c9ef;
  font-weight: 600;
}

.composer-context-text {
  font-size: 12px;
  color: #95a6ce;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#composer-context-cancel {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: stretch;
  min-width: 78px;
  animation: none !important;
}

.file-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #334069;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(15, 20, 36, 0.95);
  cursor: pointer;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.file-btn:hover {
  border-color: rgba(85, 168, 255, 0.7);
  box-shadow: 0 0 16px rgba(72, 178, 255, 0.18);
}

#message-input {
  min-width: 0;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(5, 8, 16, 0.68);
}

.drop-card {
  border: 1px solid rgba(96, 184, 255, 0.75);
  border-radius: 16px;
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(22, 31, 56, 0.95) 0%, rgba(15, 21, 37, 0.95) 100%);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.45),
    0 0 32px rgba(72, 178, 255, 0.18),
    0 0 30px rgba(255, 79, 180, 0.15);
  text-align: center;
}

.drop-title {
  font-size: 18px;
  font-weight: 600;
}

.drop-subtitle {
  color: #a0aed6;
  margin-top: 4px;
}

.call-overlay,
.incoming-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7, 11, 20, 0.72);
  z-index: 1200;
}

.call-card,
.incoming-card {
  background: linear-gradient(180deg, rgba(17, 24, 44, 0.98) 0%, rgba(13, 18, 33, 0.98) 100%);
  border: 1px solid #31406d;
  border-radius: 16px;
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(72, 178, 255, 0.16);
}

.call-card {
  width: min(860px, 96vw);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.call-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.call-peer {
  font-size: 20px;
  font-weight: 620;
}

.call-status {
  color: #a8b8dd;
}

.call-badge {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid #3a4a77;
  border-radius: 999px;
  padding: 6px 10px;
  color: #b7c8ed;
  background: rgba(24, 30, 53, 0.8);
}

.call-video-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
}

.call-video-grid video {
  width: 100%;
  min-height: 180px;
  border-radius: 12px;
  background: #070d1d;
  border: 1px solid #344371;
  object-fit: cover;
}

#remote-video.audio-only {
  object-fit: contain;
  background: radial-gradient(circle, #101a34 0%, #080f22 100%);
}

.call-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.incoming-card {
  width: min(390px, 92vw);
  padding: 18px;
}

.incoming-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 980px) {
  #chat-view {
    grid-template-columns: 1fr;
    height: calc(100vh - 20px);
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(64, 89, 148, 0.5);
    max-height: 58vh;
    overflow-y: auto;
  }

  .message {
    max-width: 94%;
  }

  .shortcuts-hint {
    display: none;
  }

  .call-video-grid {
    grid-template-columns: 1fr;
  }

  .inline-image,
  .inline-video {
    width: 100%;
  }

  .message-actions {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* UI/UX refinement layer */
:root {
  --font-ui: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-display: "Sora", "Manrope", "Segoe UI", sans-serif;
}

html,
body {
  font-family: var(--font-ui);
  letter-spacing: 0.01em;
}

h1,
h2,
h3,
.call-peer {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

#app {
  padding: clamp(12px, 2vw, 22px);
}

.card,
#chat-view,
.call-card,
.incoming-card,
.quick-modal-card {
  border-radius: 18px;
}

button {
  animation: button-breath-refined 3s ease-in-out infinite;
  transition:
    transform 0.18s var(--motion-soft),
    box-shadow 0.22s var(--motion-soft),
    border-color 0.22s var(--motion-soft),
    background-color 0.22s var(--motion-soft),
    filter 0.22s var(--motion-soft);
}

button:hover {
  transform: translateY(-1px) scale(1.004);
  box-shadow:
    0 9px 18px rgba(56, 120, 220, 0.22),
    0 5px 16px rgba(219, 82, 154, 0.2);
}

button:active {
  transform: translateY(0) scale(0.998);
}

button.ghost,
.tab,
.profile-avatar-upload {
  animation: button-breath-refined-soft 3.2s ease-in-out infinite;
}

@keyframes button-breath-refined {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-0.45px) scale(1.004);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes button-breath-refined-soft {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(65, 120, 220, 0.1);
  }
  50% {
    transform: translateY(-0.35px) scale(1.003);
    box-shadow: 0 4px 11px rgba(71, 135, 242, 0.14);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(65, 120, 220, 0.1);
  }
}

.empty-state {
  border: 1px dashed rgba(85, 122, 204, 0.48);
  border-radius: 12px;
  padding: 10px 12px;
  color: #95a8d8;
  font-size: 13px;
  background: rgba(17, 24, 43, 0.36);
}

.empty-state.compact {
  padding: 8px 10px;
  font-size: 12px;
}

.search-results,
.conversation-list,
.public-list,
.bots-list,
.invites-list {
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.chat-item {
  align-items: stretch;
  gap: 10px;
}

.item-user-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-title {
  font-size: 14px;
  font-weight: 700;
  color: #e9f0ff;
}

.item-subtitle {
  font-size: 12px;
  color: #9aabd5;
}

.item-meta-col {
  min-width: 56px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 6px;
}

.item-time {
  font-size: 11px;
  color: #8fa2d2;
}

.item-unread,
.item-kind {
  min-width: 22px;
  height: 20px;
  border-radius: 999px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.item-unread {
  color: #f4f8ff;
  border: 1px solid rgba(107, 186, 255, 0.7);
  background: linear-gradient(135deg, rgba(61, 156, 255, 0.85) 0%, rgba(244, 90, 173, 0.85) 100%);
  box-shadow: 0 0 14px rgba(72, 178, 255, 0.2);
}

.item-kind {
  color: #9fb1dc;
  border: 1px solid rgba(84, 111, 178, 0.45);
  background: rgba(22, 30, 54, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.item-actions button {
  animation: none;
  min-height: 30px;
  padding: 6px 10px;
}

.messages {
  scroll-behavior: smooth;
}

.message {
  border-radius: 15px;
  transition:
    transform 0.16s var(--motion-soft),
    border-color 0.2s var(--motion-soft),
    box-shadow 0.2s var(--motion-soft);
}

.message:hover {
  transform: translateY(-1px);
  border-color: rgba(92, 152, 248, 0.5);
}

.quick-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  background: rgba(5, 9, 17, 0.72);
  backdrop-filter: blur(2px);
}

.quick-modal-card {
  width: min(420px, 92vw);
  border: 1px solid rgba(66, 99, 171, 0.72);
  padding: 16px;
  background: linear-gradient(180deg, rgba(18, 26, 46, 0.98) 0%, rgba(12, 18, 34, 0.98) 100%);
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.52),
    0 0 24px rgba(72, 178, 255, 0.14);
  display: grid;
  gap: 10px;
}

.quick-modal-card h3 {
  margin: 0;
  font-size: 18px;
}

.quick-modal-card input {
  width: 100%;
}

.quick-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  border: 1px solid rgba(70, 105, 180, 0.56);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  color: #eaf1ff;
  background: linear-gradient(180deg, rgba(19, 28, 50, 0.95) 0%, rgba(12, 18, 34, 0.95) 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition: opacity 0.2s var(--motion-soft), transform 0.2s var(--motion-soft);
  pointer-events: auto;
  white-space: pre-line;
  cursor: pointer;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.hide {
  opacity: 0;
  transform: translateY(5px) scale(0.99);
}

.toast-success {
  border-color: rgba(70, 199, 158, 0.6);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(58, 211, 159, 0.16);
}

.toast-error {
  border-color: rgba(255, 120, 155, 0.6);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(255, 92, 125, 0.18);
}

@media (max-width: 980px) {
  .search-results,
  .conversation-list,
  .public-list,
  .bots-list,
  .invites-list {
    max-height: 220px;
  }

  .item-meta-col {
    min-width: 48px;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
}


/* Accessibility and keyboard-navigation polish */
:root {
  --focus-ring: 0 0 0 2px rgba(86, 181, 255, 0.38), 0 0 0 4px rgba(255, 79, 180, 0.18);
  --focus-border: rgba(111, 194, 255, 0.95);
}

:where(button, input, textarea, .item[role="button"], .collapse-header):focus {
  outline: none;
}

:where(button, input, textarea, .item[role="button"], .collapse-header):focus-visible {
  border-color: var(--focus-border) !important;
  box-shadow: var(--focus-ring) !important;
}

.item[role="button"] {
  cursor: pointer;
}

.chat-item.active {
  background:
    linear-gradient(180deg, rgba(28, 39, 69, 0.96) 0%, rgba(19, 27, 49, 0.95) 100%),
    linear-gradient(90deg, rgba(72, 178, 255, 0.12), rgba(255, 79, 180, 0.12));
}

.chat-item:focus-visible .item-title,
.chat-item:hover .item-title {
  color: #f3f7ff;
}

.collapse-header {
  position: relative;
}

.collapse-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--motion-soft);
  background: linear-gradient(90deg, rgba(77, 161, 255, 0.12), rgba(255, 79, 180, 0.06));
}

.collapse-header:hover::before,
.collapse-panel[open] > .collapse-header::before {
  opacity: 1;
}

.quick-modal-card {
  animation: modal-enter 0.18s var(--motion-soft);
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .quick-modal-card {
    width: calc(100vw - 20px);
  }
}
