* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", sans-serif;
}

body {
  background: #0f1115;
  color: #e8eaed;
  height: 100vh;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 340px;
  background: #151823;
  border-right: 1px solid #1f2433;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  animation: fadeUp 260ms ease;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.brand h1 {
  font-size: 18px;
}

.brand-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.brand-actions.secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brand-actions .btn {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
}

#profile-btn {
  grid-column: span 2;
}

.platform-badge {
  background: rgba(43, 78, 240, 0.2);
  border: 1px solid #2b4ef0;
  color: #c9d6ff;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.muted {
  color: #8a93a5;
  font-size: 11px;
}

.search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a3042;
  background: #0f1320;
  color: #e8eaed;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  flex: 1;
  padding: 8px;
  background: #0f1320;
  border: 1px solid #2a3042;
  color: #c0c6d4;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 160ms ease, background 160ms ease;
}

.tab.active {
  background: #2b4ef0;
  border-color: #2b4ef0;
  color: #fff;
}

.tab:hover {
  border-color: #3a4460;
  transform: translateY(-1px);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.list.compact {
  max-height: 240px;
}

.list-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f1320;
  border: 1px solid #21283a;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: transform 120ms ease, border-color 160ms ease, background 160ms ease;
}

.list-item:hover {
  border-color: #2f3750;
  transform: translateY(-1px);
}

.list-item.blocked {
  opacity: 0.6;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #2a3042;
}

.list-item.active {
  border-color: #2b4ef0;
  background: rgba(43, 78, 240, 0.15);
}

.badge {
  background: #2b4ef0;
  color: #fff;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f1115;
  animation: fadeUp 260ms ease;
}

.chat-header {
  padding: 20px;
  border-bottom: 1px solid #1f2433;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

.chat-header p {
  font-size: 12px;
  color: #8a93a5;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  padding: 12px 14px;
  border-radius: 12px;
  background: #161a26;
  border: 1px solid #1f2433;
  max-width: 70%;
  position: relative;
  animation: fadeUp 180ms ease;
}

.message.me {
  align-self: flex-end;
  background: #243067;
  border-color: #2b4ef0;
}

.message .meta {
  font-size: 11px;
  color: #a2abc2;
  margin-bottom: 6px;
}

.message .content {
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.message .actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.message .actions button {
  background: transparent;
  border: 1px solid #2a3042;
  color: #c0c6d4;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
}

.reactions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.reaction {
  padding: 2px 6px;
  border-radius: 10px;
  background: #0f1320;
  border: 1px solid #2a3042;
  font-size: 12px;
}

.reply-preview {
  font-size: 12px;
  color: #c0c6d4;
  border-left: 3px solid #2b4ef0;
  padding-left: 8px;
  margin-bottom: 8px;
}

.attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.attachments button {
  background: transparent;
  border: 1px solid #2a3042;
  color: #7ea7ff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.typing {
  padding: 0 20px 10px;
  font-size: 12px;
  color: #8a93a5;
}

.composer {
  padding: 16px 20px;
  border-top: 1px solid #1f2433;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.composer input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a3042;
  background: #0f1320;
  color: #e8eaed;
}

.btn {
  background: #2b4ef0;
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(20, 32, 80, 0.3);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  border: 1px solid #2a3042;
  color: #c0c6d4;
}

.btn.ghost:hover {
  border-color: #3a4460;
  color: #e6e9f2;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #151823;
  border: 1px solid #232a3d;
  padding: 24px;
  border-radius: 12px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: popIn 160ms ease;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.modal-content input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a3042;
  background: #0f1320;
  color: #e8eaed;
}

.modal-content select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2a3042;
  background: #0f1320;
  color: #e8eaed;
}

.device-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qr-login,
.qr-confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.verify-modal {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qr-login img {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  border: 1px solid #2a3042;
  align-self: center;
  background: #fff;
}

.auth-tabs {
  display: flex;
  gap: 8px;
}

.auth-tabs .tab {
  flex: 1;
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.banner {
  background: #1a2030;
  border: 1px solid #2a3042;
  color: #c0c6d4;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.banner.hidden {
  display: none;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emoji-picker button {
  background: #0f1320;
  border: 1px solid #2a3042;
  color: #c0c6d4;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
}

.notification {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #2b4ef0;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  animation: popIn 160ms ease;
}

.notification.hidden,
.hidden {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.shell-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b4ef0;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.shell-install {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #151823;
  border: 1px solid #232a3d;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 20;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.shell-install-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #c0c6d4;
}

.shell-install-copy strong {
  color: #fff;
  font-size: 13px;
}

.shell-install-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-splash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #1b2450, #0f1115 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: #fff;
  z-index: 30;
}

.app-splash .logo {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: linear-gradient(135deg, #2b4ef0, #1f2e77);
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.app-splash .label {
  font-size: 14px;
  color: #c0c6d4;
  letter-spacing: 0.04em;
}

@media (max-width: 820px) {
  .shell-install {
    left: 16px;
    right: 16px;
    bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .shell-install-actions {
    flex-direction: row;
    width: 100%;
  }

  .app-splash .logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    font-size: 30px;
  }
}

.pinned {
  background: #161a26;
  border-bottom: 1px solid #1f2433;
  padding: 8px 20px;
  font-size: 12px;
  color: #c0c6d4;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.device-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a93a5;
}

.device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #21283a;
  background: #0f1320;
  cursor: pointer;
  gap: 12px;
}

.device-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.device-meta {
  font-size: 11px;
  color: #8a93a5;
}

.device-tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #1b2b5a;
  color: #c9d6ff;
  font-size: 11px;
  border: 1px solid #2b4ef0;
}

.device-tag.warn {
  background: rgba(255, 158, 61, 0.15);
  border-color: #ff9e3d;
  color: #ffd6a3;
}
