﻿:root {
  --app-height: 100vh;
  --page-bg: #d6dde4;
  --page-shadow: rgba(15, 37, 56, 0.14);
  --surface: #ffffff;
  --surface-alt: #f5f7f9;
  --surface-soft: #eceff3;
  --border: #d6dce3;
  --text: #1c2833;
  --muted: #6c7784;
  --blue: #3390ec;
  --blue-deep: #2a7fd4;
  --green-bubble: #e8f5d1;
  --shadow: 0 18px 40px rgba(15, 37, 56, 0.16);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  font-family: "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(78, 107, 134, 0.08), transparent 24%),
    linear-gradient(180deg, #d7dde3 0%, #c7d0d8 100%);
  color: var(--text);
}

body {
  min-height: var(--app-height);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

button,
input,
textarea {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-view,
.app-view {
  min-height: var(--app-height);
  height: var(--app-height);
}

.auth-view {
  overflow: auto;
}

.app-view {
  overflow: hidden;
}

.auth-view {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(360px, 420px);
  align-items: center;
  gap: 40px;
  padding: 48px;
}

.auth-hero {
  max-width: 560px;
  color: #24435f;
}

.auth-logo {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border-radius: 28px;
  margin-bottom: 24px;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.38), transparent 32%),
    linear-gradient(155deg, #4f89ca, #73b0e5 56%, #9cd6ff);
  box-shadow: 0 22px 50px rgba(60, 123, 190, 0.22);
}

.auth-hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

.auth-hero p {
  margin: 0;
  max-width: 38rem;
  font-size: 1.02rem;
  line-height: 1.7;
}

.auth-points {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.auth-point {
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
}

.auth-card {
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 18px;
  background: var(--surface-soft);
}

.auth-tab,
.primary-button,
.secondary-button,
.toolbar-button,
.chat-filter,
.composer-button,
.send-button {
  border: 0;
  border-radius: 14px;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.auth-tab,
.chat-filter,
.secondary-button,
.toolbar-button,
.composer-button {
  background: transparent;
  color: var(--muted);
}

.auth-tab {
  padding: 12px 14px;
  font-weight: 600;
}

.auth-tab.active,
.chat-filter.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 16px rgba(52, 89, 122, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form h2,
.dialog-form h2 {
  margin: 0;
  font-size: 1.65rem;
}

.auth-eyebrow,
.dialog-eyebrow,
.details-label {
  margin: 0;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-form label,
.dialog-form label,
.search-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form span,
.dialog-form span {
  color: var(--muted);
  font-size: 0.9rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
  resize: none;
}

input:focus,
textarea:focus {
  outline: 0;
  border-color: rgba(51, 144, 236, 0.42);
  box-shadow: 0 0 0 4px rgba(51, 144, 236, 0.12);
}

input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}

.search-field input {
  border-color: transparent;
  border-radius: 18px;
  background: var(--surface-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.primary-button {
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--blue), var(--blue-deep));
  color: white;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(51, 144, 236, 0.22);
}

.secondary-button,
.toolbar-button,
.composer-button,
.chat-filter {
  padding: 8px 12px;
}

.secondary-button,
.toolbar-button,
.chat-filter {
  font-size: 0.88rem;
}

.secondary-button,
.toolbar-button,
.composer-button {
  background: var(--surface-soft);
}

.secondary-button {
  color: var(--text);
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 28;
  background: rgba(21, 39, 58, 0.36);
}

.app-view {
  position: fixed;
  inset: 0;
  padding: 10px;
}

.app-frame {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  height: calc(var(--app-height) - 20px);
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.app-frame.without-details {
  grid-template-columns: 320px minmax(0, 1fr);
}

.app-frame.without-details .details-panel,
.details-panel {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(248, 251, 254, 0.98), rgba(255, 255, 255, 0.96));
}

.details-panel {
  display: none;
  border-left: 1px solid var(--border);
  padding: 18px;
  gap: 14px;
}

.sidebar-header,
.sidebar-profile,
.sidebar-actions,
.sidebar-header-actions,
.chat-header,
.chat-header-main,
.chat-header-actions,
.section-head,
.conversation-row,
.discover-row,
.member-row,
.dialog-actions,
.conversation-card-panel-head,
.call-banner-row,
.call-controls {
  display: flex;
  align-items: center;
}

.sidebar-header-actions,
.details-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header,
.sidebar-profile,
.sidebar-tools,
.chat-section {
  padding: 14px 14px 0;
}

.sidebar-header,
.sidebar-profile,
.section-head,
.chat-header,
.conversation-card-panel-head {
  justify-content: space-between;
}

.brand,
.sidebar-profile,
.chat-header-main {
  gap: 10px;
}

.sidebar-profile {
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
}

.brand-badge,
.user-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-weight: 700;
  background: linear-gradient(150deg, #6aa4de, #3f86d6);
}

.brand-badge {
  width: 34px;
  height: 34px;
  font-size: 0.92rem;
}

.logo-mark {
  position: relative;
  overflow: hidden;
}

.logo-svg {
  width: 76%;
  height: 76%;
  display: block;
}

.logo-shell {
  fill: rgba(255, 255, 255, 0.15);
  stroke: rgba(255, 255, 255, 0.94);
  stroke-width: 5.6;
  stroke-linejoin: round;
}

.logo-star {
  fill: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 4.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-bird {
  fill: rgba(255, 255, 255, 0.98);
  filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.14));
}

.logo-wing {
  fill: rgba(218, 241, 255, 0.96);
}

.logo-core {
  fill: #b6e1ff;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 1.8;
  filter: drop-shadow(0 0 12px rgba(182, 225, 255, 0.32));
}

.user-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.user-avatar.large {
  width: 48px;
  height: 48px;
  font-size: 0.95rem;
}

.user-avatar.has-image {
  background: #dfe8f2 !important;
  overflow: hidden;
}

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

.brand-copy,
.sidebar-profile-copy span,
.chat-header-copy span,
.details-copy,
.member-copy span,
.conversation-meta,
.conversation-preview,
.discover-copy span,
.composer-hint,
.typing-indicator,
.message-time,
.message-subline,
.call-muted,
.empty-note {
  color: var(--muted);
}

.sidebar-profile-copy,
.chat-header-copy,
.member-copy,
.discover-copy,
.conversation-copy {
  min-width: 0;
}

.sidebar-profile-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-copy,
.conversation-copy {
  flex: 1;
  min-width: 0;
}
.sidebar-profile-copy strong,
.chat-header-copy strong,
.member-copy strong,
.discover-copy strong,
.conversation-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profileName {
  line-height: 1.1;
}

#profileHandle {
  line-height: 1.1;
}

.sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sidebar-actions .secondary-button {
  width: 100%;
  padding-inline: 8px;
}

.sidebar-actions-bottom {
  display: none !important;
  margin-top: auto;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(134, 161, 187, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(248, 251, 254, 0.98) 34%);
}

.chat-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 12px 14px 0;
}

.chat-filters::-webkit-scrollbar {
  display: none;
}

.chat-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid rgba(132, 154, 176, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: #587089;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chat-filter.active {
  border-color: rgba(51, 144, 236, 0.18);
  background: rgba(255, 255, 255, 0.96);
  color: var(--blue-deep);
  box-shadow: 0 10px 22px rgba(51, 144, 236, 0.12);
}

.chat-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding-bottom: 12px;
}

.chat-section-main {
  flex: 1 1 auto;
}

.discover-section {
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.discover-section[aria-hidden="true"] {
  display: none !important;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.84rem;
}

.conversation-list,
.discover-list,
.member-list,
.picker-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.conversation-item,
.discover-item,
.member-item,
.picker-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.conversation-item:hover,
.discover-item:hover,
.picker-item:hover {
  background: #f2f7fc;
  border-color: rgba(51, 144, 236, 0.08);
}

.conversation-item.active {
  background: rgba(51, 144, 236, 0.16);
  border-color: rgba(51, 144, 236, 0.18);
}

.conversation-preview.draft-preview {
  color: #c15a2e;
  font-weight: 600;
}

.conversation-item.unread strong {
  color: #17314c;
}

.conversation-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.conversation-tail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 52px;
  padding-top: 1px;
}

.conversation-time {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1;
  white-space: nowrap;
}

.conversation-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4ea2ef, #2d84db);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(45, 132, 219, 0.24);
}

.conversation-preview,
.conversation-meta,
.discover-copy span,
.member-copy span,
.message-subline,
.details-copy,
.empty-note {
  display: block;
  font-size: 0.9rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta {
  margin-top: 4px;
}

.chat-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(229, 232, 236, 0.94), rgba(229, 232, 236, 0.94)),
    radial-gradient(circle at 16px 16px, rgba(132, 144, 156, 0.08) 1.6px, transparent 0);
  background-size: auto, 36px 36px;
}

.chat-stage > * {
  min-width: 0;
}

.chat-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(134, 161, 187, 0.26);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(10px);
}

.chat-header-actions {
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
}

.toolbar-icon {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.incoming-banner,
.call-overlay {
  padding: 10px 14px 0;
}

.conversation-notice {
  padding: 10px 14px 0;
}

.conversation-notice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(95, 122, 146, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 24px rgba(15, 37, 56, 0.08);
}

.conversation-notice-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.conversation-notice-copy span {
  color: var(--muted);
  font-size: 0.9rem;
}

.call-banner,
.call-panel {
  border: 1px solid rgba(51, 144, 236, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px rgba(41, 71, 98, 0.12);
}

.call-banner {
  padding: 14px 16px;
}

.call-banner-row {
  justify-content: space-between;
  gap: 12px;
}

.call-actions {
  display: flex;
  gap: 8px;
}

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: rgba(10, 20, 30, 0.72);
  backdrop-filter: blur(12px);
}

.call-panel {
  display: flex;
  flex-direction: column;
  width: min(100vw, 1280px);
  height: 100vh;
  height: 100dvh;
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at top right, rgba(72, 119, 174, 0.2), transparent 28%),
    linear-gradient(180deg, rgba(15, 26, 38, 0.98), rgba(22, 34, 48, 0.98));
  color: white;
  box-shadow: none;
}

.call-heading {
  display: block;
  margin-bottom: 4px;
}

.call-muted {
  color: rgba(236, 243, 250, 0.76);
}

.call-security {
  margin-top: 6px;
  color: rgba(184, 206, 226, 0.78);
  font-size: 0.82rem;
}

.call-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 18px;
}

.call-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f9fbff, #edf3f9);
}

.call-tile.video {
  min-height: 0;
}

.call-screen {
  display: grid;
  place-items: center;
  min-height: 220px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, #8dbbed, #4b87df);
}

.call-screen video,
.call-screen audio {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #15293d;
}

.call-placeholder {
  font-size: 2rem;
  font-weight: 700;
  color: white;
}

.call-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.call-control-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.call-control-button.active {
  background: rgba(51, 144, 236, 0.14);
  color: var(--blue-deep);
}

.call-control-button.danger {
  background: #ef5d64;
  color: white;
}

.call-control-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.call-control-button .toolbar-icon {
  width: 20px;
  height: 20px;
}

.video-call-panel .call-grid.video-mode.single-remote {
  display: block;
  position: relative;
}

.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-remote {
  height: 100%;
  padding: 0;
  background: transparent;
}

.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-remote .call-screen {
  min-height: calc(100vh - 220px);
  min-height: calc(100dvh - 220px);
  border-radius: 28px;
  background: #101c29;
}

.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-remote .call-screen video {
  object-fit: cover;
}

.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-remote > strong,
.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-remote > .message-subline,
.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-local > .message-subline {
  display: none;
}

.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-local {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: min(24vw, 220px);
  min-width: 140px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 26, 39, 0.76);
  backdrop-filter: blur(12px);
  box-shadow: 0 22px 42px rgba(5, 10, 16, 0.38);
}

.video-call-panel .call-grid.video-mode.single-remote .call-tile.is-local .call-screen {
  min-height: 140px;
  border-radius: 18px;
}

.audio-call-panel .call-grid.audio-mode {
  align-content: center;
  justify-content: center;
}

.audio-call-panel .call-tile {
  max-width: min(520px, 100%);
  margin-inline: auto;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.audio-call-panel .call-screen.audio-screen {
  min-height: 260px;
  background: linear-gradient(145deg, #33506f, #203347);
}

.message-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  padding: 14px;
  scroll-padding-bottom: 126px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.message-list.conversation-feed {
  justify-content: flex-end;
}

.message-list.contacts-feed {
  justify-content: flex-start;
}

.message-list.empty-feed .empty-state-card {
  margin-top: auto;
  margin-bottom: 0;
}

.empty-state-card,
.details-card {
  border: 1px solid rgba(134, 161, 187, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.empty-state-card {
  align-self: center;
  max-width: 380px;
  padding: 20px;
  text-align: center;
}

.details-card {
  padding: 14px;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.message-row.mine {
  justify-content: flex-end;
}

.message-row.system {
  justify-content: center;
}

.message-bubble {
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px 8px;
  border-radius: 14px;
  background: white;
  box-shadow: 0 8px 18px rgba(53, 76, 96, 0.06);
}

.message-stack {
  display: flex;
  flex-direction: column;
  flex: 0 1 min(78%, 720px);
  max-width: min(78%, 720px);
  min-width: 0;
}

.message-row.mine .message-stack {
  align-items: flex-end;
}

.message-row.system .message-stack {
  align-items: center;
}

.message-avatar {
  width: 32px;
  height: 32px;
  margin-bottom: 2px;
}

.message-row.mine .message-bubble {
  background: var(--green-bubble);
}

.message-bubble.call-event {
  max-width: min(76%, 460px);
  padding: 10px 12px;
  background: linear-gradient(180deg, #f8fbff, #eef4fb);
  border: 1px solid rgba(51, 144, 236, 0.14);
}

.message-bubble.system-event {
  width: auto;
  max-width: min(72%, 560px);
  background: rgba(255, 255, 255, 0.84);
}

.message-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.call-history-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.call-history-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(51, 144, 236, 0.12);
}

.message-author {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue-deep);
}

.message-content {
  margin-top: 4px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-content.emoji-only {
  font-size: 1.55rem;
  line-height: 1.35;
}

.message-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.76rem;
}

.message-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  color: var(--muted);
}

.message-status.read {
  color: #4a90e2;
}

.message-status svg {
  width: 16px;
  height: 16px;
  display: block;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-action-button {
  border: 0;
  padding: 0 0 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
}

.message-action-button:hover {
  color: #b84444;
}

.composer {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(134, 161, 187, 0.22);
  background: linear-gradient(180deg, rgba(249, 251, 253, 0.9), rgba(255, 255, 255, 0.96));
  box-shadow: 0 -10px 24px rgba(15, 37, 56, 0.08);
}

.contacts-hub {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contacts-hub-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 2px 0;
}

.contacts-hub-head span,
.contact-card-copy span {
  color: var(--muted);
}

.contacts-hub-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(134, 161, 187, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
  box-shadow: 0 10px 24px rgba(47, 68, 88, 0.08);
}

.call-audio-sink {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0.001;
  pointer-events: none;
}

.contact-card-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}

.contact-status.online {
  color: var(--blue-deep);
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 20px;
  margin-bottom: 0;
}

.composer-hint {
  display: none;
}

.composer-recording {
  color: #c54c4c;
  font-size: 0.82rem;
  font-weight: 600;
}

.composer-recording-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
}

.recording-preview-shell {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(51, 144, 236, 0.14);
  background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.32), rgba(91, 123, 153, 0.12));
  box-shadow: 0 12px 28px rgba(41, 71, 98, 0.12);
}

.recording-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
}

.recording-meter-block {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(134, 161, 187, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.recording-waveform {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
}

.recording-wave-bar {
  flex: 1 1 0;
  min-width: 4px;
  max-width: 8px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recording-wave-bar::before {
  content: "";
  display: block;
  width: 100%;
  min-height: 12px;
  height: calc(14px + (var(--level, 0.14) * 26px));
  border-radius: 999px;
  background: linear-gradient(180deg, #5ea9ef, #2f84da);
  box-shadow: 0 6px 14px rgba(47, 132, 218, 0.18);
  transition: height 70ms linear;
}

.composer-shell {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: relative;
}

.composer-button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  font-size: 1.05rem;
  border-radius: 20px;
}

.composer-media-button.active {
  background: rgba(197, 76, 76, 0.12);
  color: #c54c4c;
}

.composer-media-button .toolbar-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-shell textarea {
  width: 100%;
  min-height: 44px;
  max-height: 144px;
  border-radius: 20px;
  overflow-y: hidden;
  resize: none;
}

.send-button {
  padding: 11px 14px;
  background: var(--blue);
  color: white;
  font-weight: 700;
}

.emoji-picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: min(272px, calc(100vw - 28px));
  max-height: 156px;
  overflow: auto;
  padding: 8px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.985);
  box-shadow: 0 20px 38px rgba(34, 58, 81, 0.18);
  backdrop-filter: blur(16px);
}

.emoji-chip {
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 1.1rem;
}

.emoji-chip:hover {
  background: rgba(51, 144, 236, 0.12);
}

.message-bubble.media-event {
  max-width: min(84%, 360px);
}

.media-message-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media-message-caption {
  line-height: 1.45;
}

.voice-message-card,
.video-note-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voice-message-card {
  padding: 2px 0 0;
}

.voice-message-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(51, 144, 236, 0.12);
  color: var(--blue-deep);
}

.voice-message-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-message-meta,
.video-note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.voice-message-meta strong,
.video-note-meta strong {
  color: var(--text);
  font-size: 0.88rem;
}

.voice-message-player,
.video-note-player {
  display: block;
  width: 100%;
}

.video-note-card {
  align-items: flex-start;
}

.video-note-shell {
  position: relative;
  display: block;
  width: min(220px, 62vw);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.18), rgba(72, 98, 124, 0.08));
  box-shadow: 0 18px 32px rgba(28, 50, 71, 0.16);
}

.video-note-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.video-note-player {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #dfe7ef;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.video-note-playbadge {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(17, 31, 43, 0.42);
  color: white;
  backdrop-filter: blur(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.video-note-shell.playing .video-note-playbadge {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}

.video-note-playbadge svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.video-note-duration {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(17, 31, 43, 0.5);
  color: white;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.details-copy {
  line-height: 1.6;
}

.user-sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-sheet-copy h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.user-sheet-copy span {
  color: var(--muted);
}

.member-list {
  gap: 8px;
}

.member-item,
.picker-item,
.discover-item {
  border-radius: 14px;
  background: var(--surface-alt);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b8c8d9;
}

.status-dot.online {
  background: #56c271;
}

.dialog-card {
  width: min(600px, calc(100vw - 24px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: var(--shadow);
}

.dialog-card::backdrop {
  background: rgba(32, 52, 72, 0.3);
  backdrop-filter: blur(6px);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
}

.picker-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(246, 249, 252, 0.92), rgba(255, 255, 255, 0.96));
}

.picker-helper,
.list-section-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.list-section-label {
  margin: 8px 6px 2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-avatar-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(244, 248, 252, 0.96), rgba(255, 255, 255, 0.98));
}

.settings-blocked-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(244, 248, 252, 0.96), rgba(255, 255, 255, 0.98));
}

.settings-avatar-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.settings-avatar-copy strong {
  font-size: 0.98rem;
}

.settings-avatar-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.avatar-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.avatar-upload-button:hover {
  background: #e4edf6;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.picker-search-field {
  margin-top: 4px;
}

.checkbox-line {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
}

.checkbox-line input {
  width: auto;
  flex: 0 0 auto;
}

.dialog-visibility {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: var(--surface-soft);
}

.segment-button {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.segment-button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 16px rgba(52, 89, 122, 0.08);
}

.dialog-actions {
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions-wrap {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.member-manage-actions,
.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.danger-button {
  background: rgba(203, 72, 72, 0.12);
  color: #b84444;
}

.tiny-button {
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.78rem;
  white-space: nowrap;
}

.tiny-button.danger {
  background: rgba(203, 72, 72, 0.12);
  color: #b84444;
}

.compact-picker-list {
  max-height: 280px;
}

.picker-item-button {
  width: 100%;
  border: 0;
  text-align: left;
}

.picker-item.selectable {
  cursor: pointer;
}

.picker-item.selected {
  border-color: rgba(51, 144, 236, 0.2);
  background: rgba(51, 144, 236, 0.12);
}

.picker-item.selected .member-copy strong {
  color: #17314c;
}

.avatar-open-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.avatar-open-button:hover {
  transform: none;
}

.avatar-viewer-dialog {
  width: min(560px, calc(100vw - 24px));
}

.avatar-viewer-shell {
  align-items: center;
}

.avatar-viewer-image {
  display: block;
  width: min(100%, 420px);
  max-height: 70vh;
  object-fit: contain;
  border-radius: 28px;
  background: #eef2f6;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.admin-stat-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(244, 248, 252, 0.98), rgba(255, 255, 255, 0.98));
}

.admin-stat-card strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.admin-stat-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-rack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 16px;
  color: white;
  background: rgba(32, 52, 72, 0.92);
  box-shadow: 0 18px 30px rgba(24, 40, 56, 0.18);
}

.toast.success {
  background: rgba(58, 150, 98, 0.94);
}

.toast.error {
  background: rgba(194, 74, 74, 0.94);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

@media (max-width: 1280px) {
  .app-frame {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .app-frame.without-details {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .details-panel {
    display: none;
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 32;
    max-height: min(78vh, 720px);
    border-left: 0;
    border-top: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -22px 48px rgba(15, 37, 56, 0.24);
    overflow: auto;
  }

  .details-panel.sheet-open {
    display: flex;
  }

  .details-panel.swiping {
    transition: none;
  }

  #closeDetailsButton {
    display: inline-flex !important;
  }
}

@media (max-width: 920px) {
  .auth-view {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .auth-hero {
    display: none;
  }

  .auth-card {
    padding: 20px;
    border-radius: 22px;
  }

  .app-view {
    padding: 0;
    overflow: hidden;
  }

  .app-frame {
    position: relative;
    height: var(--app-height);
    min-height: var(--app-height);
    max-height: var(--app-height);
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 100vw;
    max-width: 100vw;
    height: var(--app-height);
    max-height: var(--app-height);
    pointer-events: none;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 0 24px 60px rgba(15, 37, 56, 0.28);
    border-radius: 0;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    pointer-events: auto;
  }

  .sidebar.swiping {
    transition: none;
  }

  .composer-meta,
  .sidebar-actions,
  .call-banner-row,
  .call-controls {
    flex-wrap: wrap;
  }

  .chat-stage {
    min-height: var(--app-height);
    height: var(--app-height);
    max-height: var(--app-height);
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  .app-view,
  .app-frame,
  .chat-stage,
  .sidebar,
  .message-list,
  .composer,
  .dialog-card,
  .dialog-form {
    overflow-x: hidden;
  }

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

  .message-avatar {
    width: 28px;
    height: 28px;
  }

  .chat-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
  }

  .chat-header-main,
  .sidebar-actions {
    width: 100%;
  }

  .chat-header-main {
    min-width: 0;
    width: auto;
  }

  .chat-header-actions {
    width: auto;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

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

  .sidebar-actions-bottom {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .message-list {
    flex: 1 1 auto;
    padding: 16px 12px;
    padding-bottom: 12px;
  }

  .composer {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    flex: 0 0 auto;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .composer-shell {
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
  }

  .composer-shell textarea {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .sidebar-header,
  .sidebar-profile,
  .sidebar-tools,
  .chat-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .sidebar-header {
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .sidebar-profile {
    align-items: center;
  }

  .sidebar-header-actions {
    flex-wrap: nowrap;
  }

  .toolbar-button,
  .secondary-button,
  .primary-button,
  .composer-button,
  .send-button {
    transform: none !important;
  }

  .conversation-item,
  .contact-card {
    min-height: 72px;
  }

  .composer-button {
    width: 42px;
    height: 42px;
  }

  .send-button {
    padding: 12px 14px;
  }

  .contact-card {
    padding: 12px;
    gap: 10px;
  }

  .user-avatar,
  .message-avatar,
  .brand-badge,
  .icon-button,
  .composer-button,
  .toolbar-button,
  .send-button {
    flex-shrink: 0;
  }

  .contact-card-copy,
  .conversation-copy,
  .chat-header-copy,
  .sidebar-profile-copy {
    min-width: 0;
  }

  .conversation-list,
  .discover-list {
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 12px 0;
  }

  .chat-filter {
    min-height: 40px;
    padding: 0 4px;
    font-size: 0.76rem;
    letter-spacing: 0.01em;
  }

  .conversation-tail {
    min-width: 44px;
  }

  .conversation-time {
    font-size: 0.7rem;
  }

  .conversation-unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .emoji-picker {
    grid-template-columns: repeat(6, 1fr);
    left: 0;
  }

  .settings-avatar-panel {
    align-items: flex-start;
  }

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

  .conversation-notice-card {
    align-items: stretch;
    flex-direction: column;
  }

  .call-overlay {
    inset: 0;
    z-index: 64;
    padding: 0;
    pointer-events: auto;
  }

  .call-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    overflow: hidden;
    border-radius: 0;
  }

  .call-controls {
    position: static;
    margin: 0;
    padding-top: 14px;
    background: transparent;
  }

  .call-control-button {
    flex: 1 1 calc(33.333% - 8px);
    width: auto;
    min-height: 46px;
  }

  .video-call-panel .call-grid.video-mode.single-remote .call-tile.is-remote .call-screen {
    min-height: calc(100vh - 210px);
    min-height: calc(100dvh - 210px);
    border-radius: 22px;
  }

  .video-call-panel .call-grid.video-mode.single-remote .call-tile.is-local {
    right: 14px;
    bottom: 14px;
    width: min(34vw, 154px);
    min-width: 116px;
  }

  .video-call-panel .call-grid.video-mode.single-remote .call-tile.is-local .call-screen {
    min-height: 104px;
  }

  .contacts-hub-list {
    grid-template-columns: 1fr;
  }

  #mobileSidebarButton,
  #closeSidebarButton {
    display: inline-flex !important;
  }

  .recording-preview-shell {
    width: 74px;
    height: 74px;
  }
}

@media (max-width: 640px) {
  .chat-header {
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
  }

  .chat-header-actions {
    gap: 4px;
  }

  .icon-button,
  .toolbar-button,
  .composer-button {
    width: 40px;
    height: 40px;
  }

  .message-list {
    padding: 12px 10px 10px;
  }

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

  .chat-filters {
    gap: 5px;
  }

  .chat-filter {
    min-height: 38px;
    font-size: 0.72rem;
  }

  .conversation-item {
    padding: 11px;
    gap: 9px;
  }

  .send-button {
    padding: 11px 12px;
  }

  .video-note-shell {
    width: min(196px, 58vw);
  }

  .recording-meter-block {
    padding: 8px 10px;
  }

  .recording-waveform {
    gap: 3px;
  }
}
