:root {
  --bg: #071018;
  --bg-2: #0c1720;
  --surface: rgba(13, 22, 31, 0.92);
  --surface-2: rgba(18, 29, 40, 0.96);
  --surface-3: rgba(10, 18, 26, 0.96);
  --line: rgba(160, 190, 220, 0.12);
  --line-strong: rgba(160, 190, 220, 0.22);
  --ink: #eef5fb;
  --muted: #8d9eae;
  --accent: #59c1ff;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(89, 193, 255, 0.12);
  --success: #39d49c;
  --danger: #ff6b7d;
  --warning: #f5b84b;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --display: "Trebuchet MS", "Segoe UI", sans-serif;
  --ui: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--ui);
  background:
    radial-gradient(circle at top left, rgba(89, 193, 255, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.18), transparent 24%),
    linear-gradient(180deg, #08121b 0%, #050a10 100%);
}

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

code {
  font-family: var(--mono);
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1580px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 14px 0 22px;
}

.topbar,
.panel,
.auth-card,
.auth-hero,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-radius: var(--radius-xl);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-block h1,
.auth-hero h2,
.sidebar-header h2,
.chat-header h2,
.rail-header h2,
.modal-header h2 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: -0.04em;
}

.brand-block h1 {
  font-size: clamp(28px, 3vw, 42px);
}

.topbar-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.status-pill,
.soft-badge,
.hero-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-pill,
.soft-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.status-online {
  color: var(--success);
  background: rgba(57, 212, 156, 0.12);
}

.status-offline {
  color: var(--danger);
  background: rgba(255, 107, 125, 0.14);
}

.ghost-button,
.ghost-link,
.primary-button,
.icon-button,
.auth-tab {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.ghost-button,
.ghost-link,
.icon-button,
.auth-tab {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.ghost-button,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  text-decoration: none;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--ink);
}

.icon-button.secondary {
  background: rgba(255, 255, 255, 0.04);
}

.primary-button {
  min-height: 46px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--accent), #2481ff);
  color: #041019;
  font-weight: 900;
}

.ghost-button:hover,
.ghost-link:hover,
.primary-button:hover,
.icon-button:hover,
.auth-tab:hover {
  transform: translateY(-1px);
}

.wide-button {
  width: 100%;
}

.notice {
  min-height: 24px;
  margin: 10px 8px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.notice.notice-error {
  color: var(--danger);
}

.notice.notice-success {
  color: var(--success);
}

.notice:empty {
  display: none;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 450px);
  gap: 20px;
  margin-top: 18px;
}

.qr-approval-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 14px 0 0;
  padding: 18px 22px;
  border-radius: var(--radius-xl);
  background: rgba(21, 27, 37, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.qr-approval-copy h2 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: -0.03em;
}

.qr-approval-copy .subtle-copy {
  margin-top: 6px;
}

.qr-approval-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-hero,
.auth-card,
.panel,
.modal-card {
  border-radius: var(--radius-xl);
}

.auth-hero {
  padding: 30px;
  background:
    linear-gradient(140deg, rgba(89, 193, 255, 0.06), rgba(139, 92, 246, 0.1)),
    var(--surface);
}

.auth-hero h2 {
  font-size: clamp(34px, 4vw, 56px);
  line-height: 0.98;
}

.hero-copy {
  margin-top: 18px;
  max-width: 700px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 17px;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
}

.auth-card {
  padding: 22px;
}

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

.auth-tab {
  min-height: 44px;
  color: var(--ink);
  font-weight: 800;
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--accent), #2481ff);
  color: #06111a;
}

.auth-tab-disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.auth-form {
  display: grid;
  gap: 4px;
  margin-top: 16px;
}

.field-label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.text-input,
.stack-input,
.composer-input,
.small-input,
.username-prefix {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.text-input,
.stack-input,
.composer-input,
.small-input {
  width: 100%;
  border-radius: var(--radius-md);
}

.text-input,
.small-input {
  min-height: 46px;
  padding: 0 14px;
}

.stack-input,
.composer-input {
  padding: 12px 14px;
  resize: vertical;
}

.qr-placeholder {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--line-strong);
}

.qr-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.qr-display-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(89, 193, 255, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.qr-canvas {
  width: min(100%, 240px);
  height: auto;
  border-radius: 18px;
  background: #fff;
}

.qr-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 212px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.qr-panel-copy {
  min-width: 0;
}

.qr-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.qr-title-row h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: -0.03em;
}

.qr-code-block {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.qr-code-value {
  display: inline-block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.08em;
  word-break: break-word;
}

.qr-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.qr-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.messenger-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  gap: 16px;
  margin-top: 16px;
  min-height: calc(100vh - 152px);
}

.panel {
  padding: 16px;
}

.sidebar,
.chat-stage {
  display: flex;
  flex-direction: column;
}

.sidebar {
  min-height: 0;
}

.sidebar-header,
.chat-header,
.rail-header,
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

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

.config-strip {
  display: grid;
  gap: 8px;
  margin: 14px 0 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.config-field {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.config-field code {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.conversation-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.conversation-card:hover {
  transform: translateY(-1px);
  border-color: rgba(89, 193, 255, 0.35);
}

.conversation-card.active {
  background: rgba(89, 193, 255, 0.12);
  border-color: rgba(89, 193, 255, 0.36);
}

.conversation-avatar,
.chat-avatar,
.avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(89, 193, 255, 0.22), rgba(139, 92, 246, 0.34));
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
}

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

.conversation-avatar img,
.chat-avatar img,
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conversation-main {
  min-width: 0;
}

.conversation-head,
.conversation-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.conversation-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

.conversation-preview {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.conversation-type {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.conversation-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #041018;
  font-size: 11px;
  font-weight: 900;
}

.chat-stage {
  min-height: 0;
}

.chat-header {
  align-items: center;
}

.chat-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.subtle-copy,
.helper-copy,
.avatar-meta,
.activity-meta,
.message-meta {
  color: var(--muted);
}

.subtle-copy {
  margin: 8px 0 0;
  line-height: 1.5;
}

.message-list {
  display: grid;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-top: 16px;
  padding-right: 4px;
}

.message-list.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-card {
  max-width: 380px;
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  text-align: center;
}

.slim-card {
  max-width: 100%;
}

.message-row {
  display: flex;
}

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

.message-bubble {
  max-width: min(76%, 760px);
  padding: 14px 14px 12px;
  border-radius: 18px 18px 18px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.message-row.own .message-bubble {
  background: rgba(89, 193, 255, 0.1);
  border-color: rgba(89, 193, 255, 0.16);
  border-radius: 18px 18px 8px 18px;
}

.message-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.message-author {
  font-weight: 900;
}

.message-meta {
  font-size: 12px;
  white-space: nowrap;
}

.message-text {
  margin-top: 8px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.attachment-link {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

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

.message-action {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.composer-card {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.editing-banner {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(89, 193, 255, 0.12);
  color: var(--accent);
  font-weight: 900;
}

.composer-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.attachment-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.attachment-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
}

.composer-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  margin-top: 12px;
}

.composer-input {
  min-height: 84px;
}

.send-button {
  align-self: stretch;
  border-radius: var(--radius-md);
}

.right-rail {
  display: grid;
  gap: 16px;
}

.details-body,
.activity-feed {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-row,
.activity-item {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.detail-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-value {
  margin-top: 6px;
  font-weight: 800;
  word-break: break-word;
}

.detail-section,
.detail-stack {
  display: grid;
  gap: 10px;
}

.member-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.member-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.member-name {
  font-weight: 900;
}

.member-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.member-controls {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

.danger-button {
  color: var(--danger);
  border-color: rgba(255, 91, 118, 0.22);
}

.activity-title {
  font-weight: 800;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 6, 10, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(720px, calc(100vw - 20px));
  margin: 32px auto;
  padding: 18px;
  background: var(--surface-3);
}

.modal-form {
  margin-top: 16px;
}

.type-grid,
.visibility-section {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.visibility-section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.type-option,
.visibility-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  gap: 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 900;
}

.type-option input,
.visibility-card input {
  accent-color: var(--accent);
}

.avatar-picker {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.avatar-preview {
  width: 72px;
  height: 72px;
  font-size: 24px;
}

.avatar-title {
  font-size: 15px;
  font-weight: 900;
}

.avatar-meta {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.username-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
}

.username-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
}

.helper-copy {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.helper-copy.ok {
  color: var(--success);
}

.helper-copy.bad {
  color: var(--danger);
}

.stack-form {
  display: grid;
  gap: 4px;
}

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

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.small-input {
  width: 86px;
}

@media (max-width: 1320px) {
  .messenger-layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .qr-approval-banner {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .topbar-status {
    justify-content: flex-start;
  }

  .modal-card {
    margin: 14px auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 12px, 1580px);
    padding-top: 8px;
  }

  .topbar,
  .panel,
  .auth-card,
  .auth-hero,
  .modal-card {
    padding: 14px;
  }

  .composer-form,
  .type-grid,
  .visibility-section,
  .username-row {
    grid-template-columns: 1fr;
  }

  .qr-shell {
    grid-template-columns: 1fr;
  }

  .qr-title-row,
  .qr-action-row,
  .qr-approval-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .checkbox-row,
  .avatar-picker {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .member-head,
  .member-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .member-actions .ghost-button,
  .detail-stack .ghost-button,
  .composer-form .primary-button {
    width: 100%;
  }
}

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

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(122, 94, 255, 0.1), transparent 18%),
    radial-gradient(circle at 82% 4%, rgba(67, 165, 255, 0.08), transparent 20%),
    linear-gradient(180deg, #171717 0%, #0a0a0d 100%);
}

.app-shell {
  width: min(100vw - 18px, 1880px);
  padding: 10px 0 16px;
}

.topbar {
  background: rgba(31, 31, 34, 0.92);
}

.app-shell.is-authenticated {
  width: 100vw;
  max-width: 100vw;
  padding: 0;
}

.app-shell.is-authenticated .topbar {
  display: none;
}

.app-shell.is-authenticated .notice {
  position: fixed;
  left: 18px;
  right: 18px;
  top: 10px;
  z-index: 15;
  margin: 0 auto;
  width: min(620px, calc(100vw - 36px));
  min-height: 0;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(23, 23, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  backdrop-filter: blur(12px);
}

.app-shell.is-authenticated .qr-approval-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  top: 64px;
  z-index: 14;
  width: min(900px, calc(100vw - 36px));
  margin: 0 auto;
  backdrop-filter: blur(12px);
}

.messenger-layout {
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 0;
  margin-top: 0;
  min-height: 100vh;
}

.sidebar,
.chat-stage {
  min-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

.sidebar {
  padding: 14px 14px 10px;
  background: rgba(32, 32, 35, 0.98);
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-topline {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.menu-button {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-search-shell {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-search-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
}

.sidebar-search-icon::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -2px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  transform: rotate(45deg);
  transform-origin: center;
}

.sidebar-search-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
}

.sidebar-search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-avatar-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 74px;
}

.cluster-avatar {
  width: 42px;
  height: 42px;
  margin-left: -10px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(15, 15, 18, 0.95);
  background: linear-gradient(135deg, #3ab7ff 0%, #8a5cff 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.cluster-avatar:first-child {
  margin-left: 0;
}

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

.cluster-avatar-action {
  cursor: pointer;
  background: linear-gradient(135deg, #2f9cff 0%, #08c6f9 100%);
  color: #051018;
}

.sidebar-tabs {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  padding: 0 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-tab {
  min-height: 42px;
  padding: 0 8px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  font-weight: 800;
}

.sidebar-tab.active {
  color: #fff;
  border-bottom-color: #8c74ff;
}

.sidebar-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 26px;
  margin-left: 8px;
  padding: 0 10px;
  border-radius: 999px;
  background: #7f69f4;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.sidebar-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 12px;
}

.sidebar-user-copy {
  min-width: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtle-button {
  min-height: 36px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.conversation-list {
  gap: 2px;
  padding-right: 0;
  padding-bottom: 10px;
}

.conversation-card {
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border: 0;
  border-radius: 18px;
  background: transparent;
}

.conversation-card:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.04);
  border-color: transparent;
}

.conversation-card.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
}

.conversation-avatar {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, rgba(56, 184, 255, 0.35), rgba(104, 104, 255, 0.42));
}

.conversation-head {
  align-items: center;
}

.conversation-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 800;
}

.conversation-type {
  display: none;
}

.conversation-preview {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
}

.conversation-preview-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}

.conversation-preview-status {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.conversation-preview-status .message-status {
  min-width: 12px;
}

.conversation-preview-status .message-status-icon {
  width: 13px;
  height: 13px;
}

.conversation-preview-status .message-status-clock {
  width: 10px;
  height: 10px;
}

.conversation-preview-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-foot {
  min-width: 54px;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.conversation-unread {
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  background: #8c74ff;
  color: #fff;
  font-size: 13px;
}

.message-meta,
.conversation-meta-time {
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 4px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-status-row,
.sidebar-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-footer-actions {
  margin-top: 10px;
}

.chat-stage {
  position: relative;
  padding: 18px 24px 18px;
  border: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(126, 81, 255, 0.08), transparent 18%),
    radial-gradient(circle at 75% 32%, rgba(88, 176, 255, 0.05), transparent 14%),
    linear-gradient(180deg, #060609 0%, #09090d 100%);
}

.chat-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image:
    radial-gradient(circle at 25px 25px, rgba(136, 101, 255, 0.12) 0 2px, transparent 2px),
    radial-gradient(circle at 95px 75px, rgba(136, 101, 255, 0.1) 0 3px, transparent 3px),
    radial-gradient(circle at 180px 48px, rgba(136, 101, 255, 0.09) 0 2px, transparent 2px),
    radial-gradient(circle at 240px 110px, rgba(136, 101, 255, 0.09) 0 2px, transparent 2px),
    radial-gradient(circle at 320px 70px, rgba(136, 101, 255, 0.1) 0 3px, transparent 3px);
  background-size: 360px 180px;
}

.chat-stage > * {
  position: relative;
  z-index: 1;
}

.chat-header {
  align-items: center;
  padding: 10px 14px;
  border-radius: 20px;
  background: rgba(17, 17, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.chat-avatar {
  width: 48px;
  height: 48px;
}

.chat-header .eyebrow {
  margin-bottom: 4px;
}

.subtle-copy {
  color: rgba(255, 255, 255, 0.62);
}

.message-list {
  margin-top: 16px;
  padding-right: 8px;
}

.message-list.empty-state {
  min-height: calc(100vh - 210px);
}

.stage-empty-card {
  max-width: 420px;
  background: rgba(14, 14, 18, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}

.chat-stage.idle .chat-header,
.chat-stage.idle .composer-card {
  display: none;
}

.chat-stage.idle .message-list.empty-state {
  margin-top: 0;
  min-height: 100vh;
}

.message-bubble {
  background: rgba(18, 18, 24, 0.84);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.message-row.own .message-bubble {
  background: rgba(118, 102, 245, 0.24);
  border-color: rgba(140, 116, 255, 0.16);
}

.composer-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  background: rgba(17, 17, 20, 0.76);
  backdrop-filter: blur(10px);
}

.composer-card,
.editing-banner {
  border-top: 0;
}

.composer-input {
  min-height: 68px;
  background: rgba(255, 255, 255, 0.05);
}

.editing-banner {
  margin-bottom: 12px;
}

.empty-card {
  background: rgba(17, 17, 20, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-card {
  background: rgba(19, 20, 25, 0.98);
}

@media (max-width: 1180px) {
  .messenger-layout {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .messenger-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .chat-stage {
    min-height: auto;
  }

  .sidebar {
    min-height: auto;
  }

  .chat-stage.idle .message-list.empty-state {
    min-height: 58vh;
  }
}

@media (max-width: 640px) {
  .app-shell.is-authenticated .notice {
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .app-shell.is-authenticated .qr-approval-banner {
    left: 10px;
    right: 10px;
    top: 58px;
    width: calc(100vw - 20px);
  }

  .sidebar-topline {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .sidebar-avatar-cluster {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .sidebar-footer-actions,
  .sidebar-status-row {
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-footer-actions .ghost-button,
  .sidebar-footer-actions .ghost-link {
    width: 100%;
  }

  .chat-stage {
    padding: 12px;
  }
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body.body-authenticated {
  overflow: hidden;
}

.app-shell.is-authenticated {
  width: min(75vw, 1520px);
  max-width: calc(100vw - 24px);
  height: 100vh;
  margin: 0 auto;
  padding: 0;
}

.messenger-layout {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  grid-template-columns: 360px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar,
.chat-stage {
  height: 100%;
  min-height: 0;
}

.sidebar {
  overflow: hidden;
}

.chat-stage {
  overflow: hidden;
}

.sidebar-topline,
.sidebar-tabs,
.sidebar-meta-row,
.sidebar-footer,
.chat-header,
.composer-card,
.editing-banner {
  flex-shrink: 0;
}

.conversation-list,
.message-list {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.conversation-list {
  flex: 1 1 auto;
}

.message-list {
  flex: 1 1 auto;
}

.message-list.empty-state,
.chat-stage.idle .message-list.empty-state {
  min-height: 0;
  height: 100%;
}

.chat-avatar {
  position: relative;
}

.chat-avatar.is-online::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid rgba(10, 10, 13, 0.96);
  box-shadow: 0 0 0 4px rgba(57, 212, 156, 0.14);
  transform: translateY(-50%);
}

.composer-form {
  grid-template-columns: minmax(0, 1fr) 84px;
  align-items: stretch;
}

.composer-input {
  resize: none;
}

.voice-button,
.send-button {
  min-height: 68px;
  border-radius: 16px;
}

.voice-button {
  font-size: 22px;
  font-weight: 900;
}

.voice-button.recording {
  background: rgba(255, 107, 125, 0.18);
  color: var(--danger);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 125, 0.2);
}

.voice-attachment {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.voice-attachment-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-waveform {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  flex: 1;
  min-height: 38px;
}

.voice-bar {
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #87dcff 0%, #8c74ff 100%);
}

.voice-duration {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.voice-audio,
.voice-audio-pending {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.voice-audio-pending {
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1440px) {
  .app-shell.is-authenticated {
    width: min(82vw, 1440px);
  }

  .messenger-layout {
    grid-template-columns: 340px minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  body.body-authenticated {
    overflow: auto;
  }

  .app-shell.is-authenticated {
    width: 100vw;
    max-width: 100vw;
    height: auto;
  }

  .messenger-layout {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar,
  .chat-stage {
    height: auto;
  }

  .conversation-list {
    max-height: 42vh;
  }

  .message-list {
    min-height: 40vh;
  }
}

.app-shell.is-authenticated {
  width: 100vw;
  max-width: 100vw;
}

.messenger-layout {
  grid-template-columns: 348px minmax(0, 1fr);
}

.sidebar {
  width: 348px;
}

.chat-stage {
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.voice-recording-indicator {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 107, 125, 0.08);
  border: 1px solid rgba(255, 107, 125, 0.16);
}

.voice-recording-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(255, 107, 125, 0.12);
}

.voice-recording-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.voice-recording-time {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.voice-recording-waveform {
  display: flex;
  align-items: stretch;
  gap: 3px;
  min-height: 42px;
}

.recording-bar {
  --voice-bar-fill: linear-gradient(180deg, #ff98a4 0%, #ff6b7d 100%);
}

.voice-attachment {
  --voice-progress: 0%;
  width: 100%;
  max-width: 100%;
  padding: 2px 2px 0;
  border-radius: 18px;
  background: transparent;
  border: 0;
  overflow: hidden;
}

.voice-attachment-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
}

.voice-play-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  color: #7f72eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(8, 10, 18, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.voice-play-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(8, 10, 18, 0.24);
}

.voice-play-button:active {
  transform: scale(0.97);
}

.voice-play-button.is-playing {
  background: rgba(245, 244, 255, 0.96);
}

.voice-play-icon {
  width: 18px;
  height: 18px;
}

.voice-track-column {
  display: grid;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.voice-waveform-shell {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 32px;
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
  overflow: hidden;
}

.voice-waveform {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  width: 100%;
  min-height: 32px;
  height: 32px;
}

.voice-waveform-base {
  position: relative;
  z-index: 1;
}

.voice-waveform-overlay {
  position: absolute;
  inset: 0;
  width: var(--voice-progress);
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.voice-waveform-progress {
  min-width: 100%;
}

.voice-bar {
  position: relative;
  width: 2px;
  height: 100%;
  border-radius: 0;
  flex: 0 0 auto;
  pointer-events: none;
  background: transparent !important;
}

.voice-bar::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: var(--voice-bar-height, 10px);
  min-height: 3px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: var(--voice-bar-fill, rgba(255, 255, 255, 0.42));
}

.voice-bar-base::before {
  background: rgba(255, 255, 255, 0.42);
}

.voice-bar-progress::before {
  background: rgba(255, 255, 255, 0.98);
}

.voice-seek-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  touch-action: none;
}

.voice-seek-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1px;
  height: 100%;
  background: transparent;
  border: 0;
}

.voice-seek-input::-moz-range-thumb {
  width: 1px;
  height: 100%;
  background: transparent;
  border: 0;
}

.voice-waveform-shell.is-scrubbing {
  cursor: grabbing;
}

.voice-time-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.voice-current-time {
  color: rgba(255, 255, 255, 0.92);
}

.voice-audio-element {
  display: none !important;
}

.voice-audio-pending {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .messenger-layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .sidebar {
    width: 320px;
  }
}

.app-shell.is-authenticated {
  width: 100vw;
  max-width: 100vw;
  margin: 0;
}

.messenger-layout {
  grid-template-columns: 380px minmax(0, 1fr);
}

.sidebar {
  position: relative;
  width: 380px;
}

.conversation-avatar,
.chat-avatar,
.profile-summary-avatar {
  position: relative;
}

.conversation-avatar.is-online::after,
.chat-avatar.is-online::after,
.profile-summary-avatar.is-online::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid rgba(10, 10, 13, 0.96);
  box-shadow: 0 0 0 4px rgba(57, 212, 156, 0.14);
  transform: translateY(-50%);
}

.sidebar-menu {
  position: absolute;
  top: 62px;
  left: 14px;
  z-index: 12;
  min-width: 220px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(23, 23, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.sidebar-menu-item {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.sidebar-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chat-header-trigger {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-header-trigger:hover {
  opacity: 0.94;
}

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

.chat-header-main > div:last-child,
.conversation-main {
  min-width: 0;
}

#chat-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-drawer {
  position: fixed;
  inset: 0;
  z-index: 25;
}

.info-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.62);
  backdrop-filter: blur(6px);
}

.info-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(460px, calc(100vw - 18px));
  height: 100%;
  padding: 20px 18px 24px;
  overflow-y: auto;
  background: rgba(18, 18, 23, 0.98);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.34);
}

.info-drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -20px -18px 16px;
  padding: 20px 18px 16px;
  background: linear-gradient(180deg, rgba(18, 18, 23, 0.98), rgba(18, 18, 23, 0.88));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

.details-body {
  margin-top: 0;
  padding-bottom: 8px;
}

.profile-summary-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-summary-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(89, 193, 255, 0.24), rgba(139, 92, 246, 0.34));
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.profile-summary-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-summary-name {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.profile-summary-meta {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 1440px) {
  .messenger-layout {
    grid-template-columns: 348px minmax(0, 1fr);
  }

  .sidebar {
    width: 348px;
  }
}

@media (max-width: 1200px) {
  .messenger-layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .sidebar {
    width: 320px;
  }
}

@media (max-width: 920px) {
  .sidebar {
    width: auto;
  }

  .info-drawer-panel {
    width: min(520px, 100vw);
  }
}

@media (max-width: 640px) {
  .info-drawer-panel {
    width: 100%;
  }

  .sidebar-menu {
    left: 10px;
    right: 10px;
    min-width: 0;
  }
}

.info-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.info-pill.accent {
  background: rgba(89, 193, 255, 0.14);
  color: #9bddff;
}

.info-pill.success {
  background: rgba(57, 212, 156, 0.16);
  color: #89f1c9;
}

.info-pill.muted {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.62);
}

.drawer-hero-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(89, 193, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.drawer-hero-avatar {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(89, 193, 255, 0.24), rgba(139, 92, 246, 0.38));
  color: #fff;
  font-size: 30px;
  font-weight: 900;
}

.drawer-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-hero-copy {
  min-width: 0;
}

.drawer-hero-kicker {
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.drawer-hero-title {
  margin: 6px 0 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.drawer-hero-description {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  line-height: 1.55;
}

.dm-profile-hero .drawer-hero-avatar {
  border-radius: 50%;
}

.info-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-stat-card,
.detail-section-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-section-copy {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.45;
}

.member-card-rich {
  background: rgba(255, 255, 255, 0.03);
}

.member-identity {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.member-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, rgba(89, 193, 255, 0.24), rgba(139, 92, 246, 0.34));
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

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

.member-avatar.is-online::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid rgba(17, 17, 20, 0.96);
  transform: translateY(-50%);
}

.member-copy {
  min-width: 0;
}

.member-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.member-role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(89, 193, 255, 0.14);
  color: #9bddff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.member-role-pill.danger {
  background: rgba(255, 107, 125, 0.16);
  color: #ff9bab;
}

.member-controls-rich {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.member-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.member-control-field {
  display: grid;
  gap: 8px;
}

.member-select {
  width: 100%;
}

.member-toggle-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.member-toggle-chip input {
  accent-color: var(--accent);
}

.member-actions-rich {
  margin-top: 12px;
}

.member-ban-reason {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .drawer-hero-card {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .info-stat-grid,
  .member-control-grid {
    grid-template-columns: 1fr;
  }
}

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(182, 188, 198, 0.46) transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(182, 188, 198, 0.46) transparent;
}

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

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

*::-webkit-scrollbar-thumb {
  background: rgba(182, 188, 198, 0.46);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(206, 212, 222, 0.62);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.app-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(89, 193, 255, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.14), transparent 26%),
    linear-gradient(180deg, #0a0d13 0%, #05070a 100%);
}

.app-loading-card {
  width: min(460px, calc(100vw - 32px));
  padding: 28px 26px;
  border-radius: 26px;
  background: rgba(22, 23, 29, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.app-loading-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.04em;
}

.app-loading-card .subtle-copy {
  margin-top: 12px;
}

.app-shell.is-booting .app-loading-screen {
  display: flex;
}

.app-shell.is-booting #auth-view,
.app-shell.is-booting #messenger-view,
.app-shell.is-booting .notice,
.app-shell.is-booting .qr-approval-banner,
.app-shell.is-booting .topbar {
  visibility: hidden;
  pointer-events: none;
}

.sidebar-footer {
  display: none !important;
}

.mobile-back-button {
  display: none;
}

@media (max-width: 920px) {
  .app-shell.is-authenticated {
    height: 100dvh;
    overflow: hidden;
  }

  .messenger-layout {
    grid-template-columns: 1fr !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
  }

  .sidebar,
  .chat-stage {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 0 !important;
  }

  .app-shell.is-authenticated.has-active-chat .sidebar {
    display: none !important;
  }

  .app-shell.is-authenticated.has-active-chat .chat-stage {
    display: flex !important;
  }

  .app-shell.is-authenticated:not(.has-active-chat) .sidebar {
    display: flex !important;
  }

  .app-shell.is-authenticated:not(.has-active-chat) .chat-stage {
    display: none !important;
  }

  .chat-stage {
    padding: 12px 12px 14px !important;
    border-left: 0 !important;
  }

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

  .mobile-back-button {
    display: inline-flex;
  }

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

  .chat-header-badges {
    justify-content: flex-end;
  }

  .message-list {
    padding-right: 2px;
    padding-bottom: 12px;
  }

  .composer-card {
    margin-top: 10px;
    padding: 12px;
    border-radius: 18px;
  }

  .info-drawer-panel {
    width: 100vw !important;
  }
}

html,
body {
  overflow-x: hidden !important;
}

body,
.app-shell,
.messenger-layout,
.sidebar,
.chat-stage,
.message-list,
.conversation-list {
  max-width: 100%;
}

.app-shell {
  width: min(100vw - 20px, 1920px) !important;
}

.messenger-layout {
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr) !important;
  width: 100% !important;
  min-width: 0;
}

.panel,
.chat-stage,
.chat-header-main,
.message-card,
.conversation-card,
.details-body {
  min-width: 0;
}

.conversation-list,
.message-list {
  overflow-x: hidden !important;
  overflow-y: auto;
}

.app-shell.is-authenticated .sidebar {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

.app-shell.is-authenticated .conversation-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  padding-bottom: 24px !important;
  overscroll-behavior: contain;
}

.app-shell.is-authenticated {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

.app-shell.is-authenticated .messenger-layout {
  grid-template-columns: minmax(320px, 388px) minmax(0, 1fr) !important;
  gap: 0 !important;
  align-items: stretch !important;
}

.app-shell.is-authenticated .sidebar {
  padding: 14px 0 10px 14px !important;
  border-right: 0 !important;
  margin-right: 0 !important;
}

.app-shell.is-authenticated .chat-stage {
  margin-left: -12px !important;
  padding: 18px 18px 18px 12px !important;
  border-left: 0 !important;
}

.conversation-list,
.conversation-card,
.conversation-card * {
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 920px) {
  .app-shell,
  .app-shell.is-authenticated,
  .app-shell.is-authenticated .messenger-layout,
  .app-shell.is-authenticated .sidebar,
  .app-shell.is-authenticated .chat-stage {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
  }

  .app-shell.is-authenticated .sidebar {
    display: grid !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) !important;
    align-content: stretch !important;
    overflow: hidden !important;
    padding: 0 0 10px 0 !important;
  }

  .app-shell.is-authenticated .chat-stage {
    padding: 0 0 14px 0 !important;
  }

  .app-shell.is-authenticated .sidebar-topline,
  .app-shell.is-authenticated .sidebar-tabs,
  .app-shell.is-authenticated .sidebar-meta-row {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .app-shell.is-authenticated .conversation-list {
    display: grid !important;
    align-content: start !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-left: 8px !important;
    padding-right: 0 !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .app-shell.is-authenticated .chat-header,
  .app-shell.is-authenticated .message-list {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .app-shell.is-authenticated .composer-card {
    margin: 10px 12px 0 !important;
  }
}

.app-shell.is-authenticated .messenger-layout {
  position: relative !important;
  grid-template-columns: var(--sidebar-width, 348px) minmax(0, 1fr) !important;
}

.app-shell.is-authenticated .sidebar {
  position: relative !important;
  z-index: 3;
  width: auto !important;
  padding: 14px 8px 10px 14px !important;
  overflow: visible !important;
}

.app-shell.is-authenticated .sidebar-topline {
  overflow: visible;
}

.app-shell.is-authenticated .sidebar-avatar-cluster {
  padding-right: 6px;
}

.app-shell.is-authenticated .conversation-list {
  padding-right: 8px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  align-content: flex-start !important;
  gap: 2px !important;
}

.app-shell.is-authenticated .conversation-card {
  flex: 0 0 auto !important;
  min-height: 74px;
}

.app-shell.is-authenticated .chat-stage {
  position: relative !important;
  z-index: 1;
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-width, 348px) - 5px);
  width: 10px;
  z-index: 4;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}

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

.sidebar-resize-handle:hover::before,
body.is-resizing-sidebar .sidebar-resize-handle::before {
  display: none;
}

body.is-resizing-sidebar {
  cursor: col-resize;
  user-select: none;
}

@media (min-width: 921px) {
  .app-shell.is-authenticated .chat-stage {
    margin-left: -12px !important;
    width: calc(100% + 12px) !important;
    max-width: none !important;
    padding: 18px 18px 18px 12px !important;
    border-left: 0 !important;
  }

  .app-shell.is-authenticated .chat-header {
    padding: 10px 14px !important;
  }

  .app-shell.is-authenticated .message-list {
    padding-right: 8px !important;
  }
}

@media (max-width: 920px) {
  .app-shell.is-authenticated,
  .app-shell.is-authenticated .messenger-layout,
  .app-shell.is-authenticated .sidebar {
    height: 100dvh !important;
    min-height: 100dvh !important;
  }

  .app-shell.is-authenticated .messenger-layout {
    grid-template-columns: 1fr !important;
  }

  .app-shell.is-authenticated .sidebar {
    padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px)) 0 !important;
    overflow: hidden !important;
  }

  .app-shell.is-authenticated .conversation-list {
    max-height: none !important;
    height: 100% !important;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sidebar-resize-handle {
    display: none !important;
  }
}

.app-shell.is-authenticated .message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 18px !important;
}

.app-shell.is-authenticated .message-row {
  width: 100%;
}

.app-shell.is-authenticated .message-bubble {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(64%, 760px);
  padding: 10px 12px 8px;
  border-radius: 18px 18px 18px 8px;
}

.app-shell.is-authenticated .message-row.own .message-bubble {
  margin-left: auto;
  border-radius: 18px 18px 8px 18px;
}

.app-shell.is-authenticated .message-bubble.has-media {
  max-width: min(430px, 74%);
  padding: 6px 6px 8px;
}

.app-shell.is-authenticated .message-author {
  font-size: 13px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.82);
}

.app-shell.is-authenticated .message-text {
  margin-top: 0;
  line-height: 1.48;
}

.app-shell.is-authenticated .message-attachments {
  margin-top: 0;
}

.message-image-attachment {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.message-image {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.message-image-placeholder {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(116, 110, 255, 0.22), rgba(41, 181, 255, 0.16)),
    rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.app-shell.is-authenticated .message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 18px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  font-weight: 700;
}

.message-edited-label {
  opacity: 0.82;
}

.message-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  letter-spacing: -0.06em;
  font-weight: 900;
}

.message-status.delivered,
.message-status.pending {
  color: rgba(255, 255, 255, 0.7);
}

.message-status.read {
  color: #9bc7ff;
}

.message-status.failed {
  color: #ff7a8f;
}

.app-shell.is-authenticated .message-actions {
  margin-top: 2px;
  justify-content: flex-end;
}

.app-shell.is-authenticated .composer-card {
  margin-top: 10px;
  padding: 12px;
  border-radius: 24px;
  background: rgba(18, 18, 22, 0.92);
}

.app-shell.is-authenticated .composer-toolbar {
  margin-bottom: 8px;
}

.app-shell.is-authenticated .composer-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 0;
}

.composer-input-shell {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex: 1;
  min-height: 58px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.app-shell.is-authenticated .composer-input {
  min-height: 28px;
  max-height: 160px;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 1.45;
}

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

.composer-attach-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 50%;
  background: transparent;
}

.composer-primary-button {
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.app-shell.is-authenticated .voice-button {
  background: rgba(255, 255, 255, 0.08);
}

.app-shell.is-authenticated .send-button {
  box-shadow: 0 10px 24px rgba(63, 160, 255, 0.22);
}

@media (max-width: 920px) {
  .app-shell.is-authenticated .message-bubble {
    max-width: 82%;
  }

  .app-shell.is-authenticated .message-bubble.has-media {
    max-width: 86%;
  }

  .app-shell.is-authenticated .composer-card {
    padding: 10px;
    border-radius: 20px;
  }

  .composer-primary-button {
    width: 50px;
    min-width: 50px;
    height: 50px;
    min-height: 50px;
  }
}

.app-shell.is-authenticated .message-list {
  padding: 18px 18px 20px 14px !important;
  gap: 14px !important;
}

.app-shell.is-authenticated .message-row {
  align-items: flex-end;
}

.app-shell.is-authenticated .message-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.app-shell.is-authenticated .message-row.own .message-stack {
  align-items: flex-end;
}

.app-shell.is-authenticated .message-day-separator {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  pointer-events: none;
  margin: 2px 0 4px;
}

.app-shell.is-authenticated .message-sticky-day-indicator {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: flex;
  justify-content: center;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.app-shell.is-authenticated .message-sticky-day-indicator.hidden {
  display: none;
}

.app-shell.is-authenticated .message-day-separator.is-current-day-source .message-day-pill {
  visibility: hidden;
}

.app-shell.is-authenticated .message-day-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(21, 24, 34, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
  color: rgba(232, 239, 248, 0.84);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.app-shell.is-authenticated .message-bubble {
  gap: 9px;
  max-width: min(62%, 760px);
  width: fit-content;
  min-width: min(168px, 100%);
  padding: 11px 13px 8px;
  border-radius: 18px 18px 18px 10px;
  background: rgba(26, 26, 32, 0.92);
  border-color: rgba(255, 255, 255, 0.04);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
  -webkit-user-select: none;
  user-select: none;
}

.app-shell.is-authenticated .message-row.own .message-bubble {
  border-radius: 18px 18px 10px 18px;
  background: rgba(128, 105, 255, 0.26);
  border-color: rgba(148, 122, 255, 0.18);
}

.app-shell.is-authenticated .message-bubble.has-media {
  max-width: min(430px, 72%);
  width: auto;
  min-width: min(220px, 100%);
  padding: 6px 6px 8px;
}

.app-shell.is-authenticated .message-bubble.has-voice {
  max-width: min(360px, 74%);
  min-width: min(280px, 100%);
}

.app-shell.is-authenticated .message-bubble.has-media .message-text {
  padding: 2px 8px 0;
}

.app-shell.is-authenticated .message-author {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.78);
}

.app-shell.is-authenticated .message-author-button {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color 0.16s ease, opacity 0.16s ease;
}

.app-shell.is-authenticated .message-author-button:hover {
  color: rgba(138, 203, 255, 0.98);
}

.app-shell.is-authenticated .message-author-button:focus,
.app-shell.is-authenticated .message-author-button:focus-visible {
  outline: none;
  color: rgba(138, 203, 255, 0.98);
}

.app-shell.is-authenticated .message-text {
  font-size: 15px;
  line-height: 1.44;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
}

.app-shell.is-authenticated .message-attachments {
  gap: 10px;
}

.message-image-attachment {
  position: relative;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.message-image-attachment.is-loading {
  cursor: progress;
}

.message-image {
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: cover;
}

.message-image-placeholder {
  min-height: 240px;
}

.attachment-link {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.attachment-link:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.app-shell.is-authenticated .message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 17px;
  font-size: 11px;
  line-height: 1;
  max-width: 100%;
  -webkit-user-select: none;
  user-select: none;
}

.message-status {
  min-width: auto;
}

.app-shell.is-authenticated .own-message-actions {
  margin-top: 6px;
  padding: 0 4px;
  align-self: flex-end;
  -webkit-user-select: none;
  user-select: none;
}

.message-status-checks {
  display: inline-flex;
  align-items: center;
  gap: 0;
  letter-spacing: -0.18em;
  transform: translateY(-0.5px);
}

.message-status-clock {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  opacity: 0.94;
}

.message-status-clock::before,
.message-status-clock::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: currentColor;
  transform-origin: 0 0;
}

.message-status-clock::before {
  width: 1.5px;
  height: 4px;
  transform: translate(-50%, -100%);
}

.message-status-clock::after {
  width: 3px;
  height: 1.5px;
  transform: translate(0, -50%);
}

.app-shell.is-authenticated .composer-card {
  margin-top: 12px;
  padding: 10px 14px 14px;
  border-radius: 26px;
  background: rgba(18, 18, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.045);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.18);
}

.app-shell.is-authenticated .composer-toolbar {
  margin-bottom: 10px;
}

.app-shell.is-authenticated .composer-form {
  gap: 14px;
  align-items: flex-end;
}

.composer-input-shell {
  min-height: 60px;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.app-shell.is-authenticated .composer-input {
  min-height: 26px;
  padding-top: 1px;
  color: rgba(255, 255, 255, 0.96);
  font-size: 15px;
  line-height: 1.42;
}

.app-shell.is-authenticated .composer-input::placeholder {
  color: rgba(255, 255, 255, 0.36);
}

.composer-inline-actions {
  align-self: center;
}

.composer-attach-button {
  color: rgba(255, 255, 255, 0.74);
}

.composer-primary-button {
  box-shadow: 0 12px 28px rgba(63, 160, 255, 0.18);
}

.app-shell.is-authenticated .voice-recording-indicator {
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 920px) {
  .app-shell.is-authenticated .message-list {
    padding: 12px 10px 14px !important;
  }

  .app-shell.is-authenticated .message-sticky-day-indicator {
    top: 6px;
  }

  .app-shell.is-authenticated .message-bubble {
    max-width: 84%;
  }

  .app-shell.is-authenticated .message-bubble.has-media {
    max-width: 88%;
  }

  .app-shell.is-authenticated .composer-card {
    padding: 10px 10px 12px;
    border-radius: 22px;
  }

  .composer-input-shell {
    min-height: 56px;
    padding: 10px 14px;
  }
}

@media (min-width: 921px) {
  .app-shell.is-authenticated .chat-stage {
    --chat-column-width: 780px;
    --chat-header-width: 744px;
  }

  .app-shell.is-authenticated .chat-header {
    width: min(100%, var(--chat-header-width)) !important;
    margin-inline: auto !important;
  }

  .app-shell.is-authenticated .message-list,
  .app-shell.is-authenticated .composer-card {
    width: min(100%, var(--chat-column-width)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .app-shell.is-authenticated .message-list {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  .app-shell.is-authenticated .composer-card {
    margin-top: 12px !important;
  }
}

.ui-icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

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

.message-status-icon {
  width: 15px;
  height: 15px;
}

.app-shell.is-authenticated .composer-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.app-shell.is-authenticated .composer-form {
  gap: 10px !important;
  align-items: flex-end !important;
}

.composer-input-shell {
  position: relative;
  display: block !important;
  flex: 1;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.app-shell.is-authenticated .composer-input {
  min-height: 22px !important;
  max-height: none;
  padding: 13px 56px 13px 18px !important;
  border-radius: 20px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  outline: none !important;
  resize: none !important;
  scrollbar-gutter: stable;
}

.app-shell.is-authenticated .composer-input:focus,
.app-shell.is-authenticated .composer-input:focus-visible {
  outline: none !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12) !important;
}

.app-shell.is-authenticated .composer-input.is-scrollable {
  overflow-y: auto !important;
}

.composer-inline-actions {
  position: absolute;
  right: 10px;
  bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-attach-button {
  width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.composer-primary-button {
  width: 46px !important;
  min-width: 46px !important;
  height: 46px !important;
  min-height: 46px !important;
  border-radius: 50% !important;
}

.app-shell.is-authenticated .voice-button,
.app-shell.is-authenticated .send-button {
  align-self: center;
}

@media (min-width: 921px) {
  .app-shell.is-authenticated .chat-stage {
    --chat-column-width: 780px;
    --chat-header-width: 860px;
  }

  .app-shell.is-authenticated .chat-header {
    width: min(100%, var(--chat-header-width)) !important;
    margin-inline: auto !important;
  }

  .app-shell.is-authenticated .message-list {
    width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 12px !important;
  }

  .app-shell.is-authenticated .message-row {
    width: min(100%, var(--chat-column-width)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .app-shell.is-authenticated .composer-card {
    width: min(100%, var(--chat-column-width)) !important;
    margin: 12px auto 0 !important;
  }
}

@media (max-width: 920px) {
  .app-shell.is-authenticated .composer-card {
    margin: 10px 12px 0 !important;
  }

  .app-shell.is-authenticated .composer-input {
    padding: 12px 54px 12px 16px !important;
  }

  .composer-inline-actions {
    right: 9px;
    bottom: 6px;
  }
}

.app-shell.is-authenticated .chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-shell.is-authenticated .chat-header-trigger,
.app-shell.is-authenticated .chat-header-main,
.app-shell.is-authenticated .chat-header-main > div:last-child,
.app-shell.is-authenticated .chat-header-badges {
  min-width: 0;
}

.app-shell.is-authenticated .chat-header-main {
  gap: 10px;
}

.app-shell.is-authenticated .chat-header-badges {
  align-self: center;
  justify-content: flex-end;
  gap: 6px;
}

.app-shell.is-authenticated .chat-avatar {
  width: clamp(40px, 4vw, 48px);
  height: clamp(40px, 4vw, 48px);
  font-size: clamp(16px, 1.5vw, 18px);
}

.app-shell.is-authenticated #chat-title {
  font-size: clamp(18px, 1.55vw, 24px);
  line-height: 1.14;
}

.app-shell.is-authenticated #chat-meta {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(11px, 0.95vw, 13px);
}

.app-shell.is-authenticated .message-list {
  padding-right: 2px !important;
}

@media (min-width: 921px) {
  .app-shell.is-authenticated .message-list {
    padding-right: 2px !important;
  }
}

@media (max-width: 920px) {
  .app-shell.is-authenticated .chat-header {
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 18px;
  }

  .app-shell.is-authenticated .chat-avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .app-shell.is-authenticated #chat-title {
    font-size: 17px;
  }

  .app-shell.is-authenticated #chat-meta {
    font-size: 11px;
  }

  .app-shell.is-authenticated .chat-header-badges {
    gap: 4px;
  }
}

.app-shell.is-authenticated .chat-stage {
  --chat-header-side-gap: 65px;
}

.app-shell.is-authenticated .message-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(182, 188, 204, 0.26) transparent;
}

.app-shell.is-authenticated .message-list::-webkit-scrollbar {
  width: 10px;
}

.app-shell.is-authenticated .message-list::-webkit-scrollbar-track {
  background: transparent;
}

.app-shell.is-authenticated .message-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(182, 188, 204, 0.22);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.app-shell.is-authenticated .message-list:hover::-webkit-scrollbar-thumb {
  background: rgba(182, 188, 204, 0.46);
  background-clip: padding-box;
}

.message-forwarded-label {
  max-width: 100%;
  font-size: 12px;
  font-weight: 700;
  color: rgba(182, 192, 255, 0.86);
  overflow-wrap: anywhere;
}

.message-reply-preview {
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid rgba(135, 155, 255, 0.75);
  color: rgba(226, 232, 244, 0.78);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.message-context-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  gap: 4px;
  min-width: 220px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(19, 22, 31, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.message-context-item {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(237, 241, 247, 0.96);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.message-context-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.message-context-item.hidden {
  display: none;
}

.message-forward-target {
  justify-content: flex-start;
}

.message-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.message-meta-name {
  font-size: 14px;
  font-weight: 700;
  color: rgba(242, 246, 252, 0.96);
}

.message-meta-copy {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(198, 207, 221, 0.72);
}

.message-meta-time {
  white-space: nowrap;
  font-size: 12px;
  color: rgba(198, 207, 221, 0.72);
}

.message-meta-edit-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.message-meta-diff {
  display: grid;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(224, 231, 241, 0.86);
}

@media (min-width: 921px) {
  .app-shell.is-authenticated .chat-stage {
    padding-right: 0 !important;
  }

  .app-shell.is-authenticated .chat-header {
    width: calc(100% - (var(--chat-header-side-gap) * 2)) !important;
    max-width: none !important;
    margin-left: var(--chat-header-side-gap) !important;
    margin-right: var(--chat-header-side-gap) !important;
  }

  .app-shell.is-authenticated .message-list {
    width: 100% !important;
    margin: 0 !important;
    padding-right: 2px !important;
  }
}

@media (max-width: 920px) {
  .app-shell.is-authenticated .chat-stage {
    --chat-header-side-gap: 12px;
  }
}

.auth-ocean-canvas,
.auth-ocean-fade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.auth-ocean-canvas {
  z-index: 0;
}

.auth-ocean-fade {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 5%, rgba(22, 140, 255, 0.08), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.5));
}

body.body-authenticated .auth-ocean-canvas,
body.body-authenticated .auth-ocean-fade,
body.body-authenticated .wave-setting {
  opacity: 0;
  visibility: hidden;
}

.app-shell:not(.is-authenticated) {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 32px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.app-shell:not(.is-authenticated) #topbar,
.app-shell:not(.is-authenticated) .auth-hero {
  display: none !important;
}

.app-shell:not(.is-authenticated) #auth-view {
  width: 100%;
  margin: 0;
  display: flex;
  justify-content: center;
}

.auth-center-shell {
  width: 440px;
  max-width: calc(100vw - 32px);
}

.app-shell:not(.is-authenticated) .notice {
  width: min(440px, calc(100vw - 32px));
  min-height: 0;
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(10, 18, 28, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  text-align: center;
  color: #b9d6ea;
}

.app-shell:not(.is-authenticated) .qr-approval-banner {
  width: min(760px, calc(100vw - 32px));
  margin: 0 0 14px;
  padding: 18px 20px;
  border-radius: 28px;
  background: rgba(18, 30, 45, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px) saturate(180%);
}

.auth-card-ocean {
  width: 100%;
  padding: 28px 24px 32px !important;
  border-radius: 38px !important;
  background: rgba(18, 30, 45, 0.68) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3) !important;
}

.legacy-auth-tabs {
  display: none !important;
}

.auth-dynamic-title {
  margin: 0 0 7px;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #fff;
}

.logo-blue {
  color: #168cff;
}

.auth-dynamic-desc {
  margin: 0 0 24px;
  text-align: center;
  color: #8aaec9;
  font-size: 14px;
}

.form {
  display: none;
}

.form.active {
  display: block;
  animation: authFadeLift 0.22s ease;
}

@keyframes authFadeLift {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field {
  margin-bottom: 16px;
}

.auth-clean-label {
  display: block;
  margin: 0 0 6px;
  color: #bfdfef;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

.app-shell:not(.is-authenticated) .auth-form {
  margin-top: 0;
  gap: 0;
}

.auth-clean-input {
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: rgba(0, 12, 22, 0.55) !important;
  color: white !important;
  outline: none;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-clean-input:focus {
  border-color: rgba(34, 140, 255, 0.5) !important;
  box-shadow: 0 0 0 2px rgba(34, 140, 255, 0.2);
}

.main-btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 30px;
  margin-top: 8px;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(95deg, #0d6bdd, #168cff);
  box-shadow: 0 6px 16px rgba(0, 30, 60, 0.4);
  transition: opacity 0.18s ease, transform 0.05s linear;
}

.main-btn:hover {
  opacity: 0.92;
}

.main-btn:active {
  transform: scale(0.97);
}

.main-btn.disabled-btn {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.1);
}

.link-row {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.forgot-hyperlink,
.doc-link {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.forgot-hyperlink {
  color: #8bcbff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.back {
  width: 100%;
  min-height: 48px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(25, 45, 65, 0.45);
  color: #d9edff;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.1s ease, transform 0.05s linear, border-color 0.1s ease;
}

.back:hover {
  background: rgba(34, 140, 255, 0.2);
  border-color: rgba(34, 140, 255, 0.3);
}

.back:active {
  transform: scale(0.97);
}

.app-shell:not(.is-authenticated) .qr-placeholder {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.qr-box {
  display: flex;
  justify-content: center;
  margin: 8px 0 20px;
}

.qr {
  position: relative;
  width: 210px;
  height: 210px;
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.app-shell:not(.is-authenticated) .qr-canvas {
  width: 100%;
  height: 100%;
  border-radius: 28px;
  background: #ffffff;
}

.app-shell:not(.is-authenticated) .qr-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  color: #1d2c3d;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
}

.qr-extra-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 0 0 12px;
}

.qr-copy-btn,
.qr-reserve-btn {
  min-height: 38px;
  padding: 0 20px;
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(25, 45, 65, 0.5);
  color: #dcf4ff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.qr-actions {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qr-link {
  min-height: 48px;
  border: 0;
  border-radius: 48px;
  background: rgba(0, 0, 0, 0.25);
  color: #b4cfff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 16px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(4px);
}

.qr-link-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #d6e9f8;
}

.small {
  margin-top: 20px;
  text-align: center;
  color: #7fa1bc;
  font-size: 12px;
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 18px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #cfe1ec;
  font-size: 13px;
  line-height: 1.35;
}

.check-row input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  padding: 0;
  accent-color: #168cff;
  cursor: pointer;
}

.doc-link {
  color: #7bcde2;
  font-weight: 600;
  border-bottom: 1px dashed rgba(34, 140, 255, 0.6);
}

.modal-docs {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  background: rgba(0, 2, 6, 0.85);
  backdrop-filter: blur(16px);
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-docs.active {
  visibility: visible;
  opacity: 1;
}

.docs-card {
  width: min(460px, calc(100vw - 36px));
  background: rgba(15, 28, 40, 0.96);
  border-radius: 34px;
  padding: 28px 24px;
  border: 1px solid rgba(34, 140, 255, 0.25);
  box-shadow: 0 28px 48px rgba(0, 0, 0, 0.5);
}

.docs-card h3 {
  margin: 0 0 20px;
  font-size: 24px;
  text-align: center;
  color: #e0f0ff;
}

.docs-card p {
  margin: 16px 0;
  color: #cde3f0;
  line-height: 1.5;
}

.close-docs {
  width: 100%;
  margin-top: 24px;
  min-height: 48px;
  border: 0;
  border-radius: 40px;
  background: #168cff;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.wave-setting {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  width: 50px;
  height: 34px;
  overflow: hidden;
  background: rgba(5, 18, 30, 0.7);
  backdrop-filter: blur(12px);
  padding: 7px 9px;
  border-radius: 999px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbe6ff;
  user-select: none;
  transition: width 0.25s ease;
}

.wave-setting:hover {
  width: 164px;
}

.wave-setting span {
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-4px);
  transition: 0.2s ease;
}

.wave-setting:hover span {
  opacity: 1;
  transform: translateX(0);
}

.wave-setting input {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 18px;
  min-width: 32px;
  padding: 0;
  border-radius: 999px;
  background: rgba(30, 55, 80, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  cursor: pointer;
}

.wave-setting input::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 1px;
  top: 1px;
  border-radius: 50%;
  background: #c2e2ff;
  transition: transform 0.18s ease;
}

.wave-setting input:checked {
  background: linear-gradient(90deg, #0d5b9e, #168cff);
}

.wave-setting input:checked::after {
  transform: translateX(14px);
  background: #fff;
}

@media (max-width: 520px) {
  .app-shell:not(.is-authenticated) {
    padding: 22px 14px 30px;
  }

  .auth-card-ocean {
    padding: 22px 18px 28px !important;
    border-radius: 30px !important;
  }

  .qr {
    width: 180px;
    height: 180px;
  }

  .qr-extra-actions {
    gap: 10px;
  }

  .qr-copy-btn,
  .qr-reserve-btn {
    min-height: 34px;
    padding: 0 14px;
  }

  .wave-setting {
    right: 12px;
    bottom: 12px;
  }
}

.media-call-bar,
.media-call-incoming-banner {
  width: min(1160px, calc(100vw - 48px));
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(16, 22, 34, 0.95), rgba(10, 14, 24, 0.95));
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.media-call-bar.is-ringing,
.media-call-incoming-banner.is-ringing {
  border-color: rgba(126, 179, 255, 0.44);
  animation: media-call-pulse 1.5s ease-in-out infinite;
}

.media-call-bar.is-live {
  border-color: rgba(91, 255, 177, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(91, 255, 177, 0.12);
}

@keyframes media-call-pulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28), 0 0 0 0 rgba(108, 154, 255, 0.06);
  }

  50% {
    transform: translateY(-1px);
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.32), 0 0 0 12px rgba(108, 154, 255, 0.12);
  }
}

.media-call-bar-copy,
.media-call-incoming-copy {
  min-width: 0;
}

.media-call-bar-copy h2,
.media-call-incoming-copy h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.media-call-bar-copy .subtle-copy,
.media-call-incoming-copy .subtle-copy {
  margin: 6px 0 0;
}

.media-call-bar-actions,
.media-call-incoming-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.media-room-header-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 42px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.media-room-header-button.is-pill {
  min-width: auto;
  padding-inline: 14px;
}

.media-room-header-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.media-room-header-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.media-room-header-button:hover {
  transform: translateY(-1px);
}

.media-room-header-button.is-active {
  background: linear-gradient(135deg, rgba(81, 131, 255, 0.35), rgba(40, 204, 255, 0.28));
  border-color: rgba(126, 179, 255, 0.42);
}

.media-room-header-button.has-live-room::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3eff94;
  box-shadow: 0 0 0 4px rgba(62, 255, 148, 0.16);
}

.media-room-header-button.is-ringing {
  animation: media-room-ring 1.35s ease-in-out infinite;
}

@keyframes media-room-ring {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(98, 145, 255, 0.05);
  }

  50% {
    transform: translateY(-1px);
    box-shadow: 0 0 0 10px rgba(98, 145, 255, 0.12);
  }
}

.media-room-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.media-room-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(76, 120, 255, 0.16), transparent 42%),
    rgba(4, 8, 14, 0.82);
  backdrop-filter: blur(16px);
}

.media-room-panel {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100vw - 36px));
  max-height: min(920px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(16, 20, 30, 0.96), rgba(10, 12, 19, 0.96));
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.media-room-panel.is-direct-call {
  width: min(920px, calc(100vw - 40px));
}

.media-room-panel.is-direct-call .media-room-side {
  display: none;
}

.media-room-panel.is-direct-call .media-room-body {
  grid-template-columns: 1fr;
}

.media-room-panel.is-direct-call .media-room-actions {
  justify-content: center;
}

.media-room-panel.is-direct-call .media-room-actions #media-room-leave-button {
  margin-left: 0;
}

.media-room-panel.is-audio-call .media-room-screen-stage {
  min-height: 460px;
}

.media-room-panel.is-video-call .media-room-video-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.media-room-header {
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.media-room-header h2 {
  margin: 0;
}

.media-room-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

.media-room-stage,
.media-room-side {
  min-height: 0;
}

.media-room-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.media-room-screen-stage,
.media-room-video-grid,
.media-room-members {
  min-height: 0;
}

.media-room-screen-stage {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-height: 320px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(145deg, rgba(20, 24, 38, 0.94), rgba(9, 11, 18, 0.96));
  overflow: hidden;
}

.media-room-screen-stage.is-waiting {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, rgba(89, 134, 255, 0.18), transparent 48%),
    linear-gradient(145deg, rgba(18, 22, 38, 0.98), rgba(8, 10, 17, 0.98));
}

.media-room-screen-card {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 320px;
  background: #07090f;
}

.media-room-waiting-card {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 28px 20px;
  text-align: center;
}

.media-room-waiting-avatar-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: 164px;
  height: 164px;
}

.media-room-waiting-orbit {
  position: absolute;
  inset: 50%;
  border-radius: 50%;
  border: 1px solid rgba(130, 173, 255, 0.24);
  transform: translate(-50%, -50%);
}

.media-room-waiting-orbit-outer {
  width: 164px;
  height: 164px;
  animation: media-room-waiting-ring 2.8s ease-in-out infinite;
}

.media-room-waiting-orbit-inner {
  width: 128px;
  height: 128px;
  animation: media-room-waiting-ring 2s ease-in-out infinite reverse;
}

.media-room-waiting-avatar {
  position: relative;
  z-index: 1;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, rgba(109, 144, 255, 0.95), rgba(55, 204, 255, 0.92));
  box-shadow: 0 14px 32px rgba(51, 102, 255, 0.28);
}

.media-room-waiting-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-room-waiting-copy {
  display: grid;
  gap: 8px;
  max-width: 520px;
}

.media-room-waiting-copy h3 {
  margin: 0;
  font-size: 32px;
  line-height: 1.05;
}

.media-room-waiting-copy p,
.media-room-waiting-meta span {
  margin: 0;
  color: rgba(220, 230, 252, 0.78);
}

.media-room-waiting-meta {
  display: grid;
  gap: 4px;
}

.media-room-waiting-meta strong {
  font-size: 30px;
  letter-spacing: 0.04em;
  color: #f7fbff;
}

.media-room-audio-hero {
  display: grid;
  justify-items: center;
  gap: 20px;
  width: 100%;
  padding: 28px 20px;
  text-align: center;
}

.media-room-audio-hero-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 52px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, rgba(109, 144, 255, 0.96), rgba(55, 204, 255, 0.94));
  box-shadow: 0 18px 38px rgba(31, 78, 210, 0.32);
}

.media-room-audio-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-room-audio-hero-copy {
  display: grid;
  gap: 8px;
}

.media-room-audio-hero-copy h3 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
}

.media-room-audio-hero-copy p {
  margin: 0;
  font-size: 14px;
  color: rgba(220, 230, 252, 0.78);
}

@keyframes media-room-waiting-ring {
  0%,
  100% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.98);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

.media-room-screen-meta {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(4, 8, 14, 0.62);
  backdrop-filter: blur(12px);
}

.media-room-screen-meta strong,
.media-room-video-head strong,
.media-room-member-copy strong {
  font-size: 14px;
  color: #f5f8ff;
}

.media-room-screen-meta span,
.media-room-video-head span,
.media-room-member-copy span,
.media-room-side-title {
  font-size: 12px;
  color: rgba(208, 220, 245, 0.78);
}

.media-room-screen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.media-room-screen-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 4px;
}

.media-room-screen-chip {
  min-width: max-content;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #f2f6ff;
  cursor: pointer;
}

.media-room-screen-chip.is-active {
  background: rgba(98, 145, 255, 0.25);
  border-color: rgba(126, 179, 255, 0.42);
}

.media-room-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  overflow: auto;
  padding-right: 4px;
}

.media-room-video-grid.has-dominant {
  grid-auto-flow: dense;
}

.media-room-video-tile {
  display: flex;
  flex-direction: column;
  min-height: 180px;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(16, 20, 31, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.media-room-video-tile.is-dominant {
  grid-column: span 2;
  min-height: 260px;
}

.media-room-video-tile.is-speaking,
.media-room-member-card.is-speaking,
.media-room-screen-card.is-speaking {
  border-color: rgba(91, 255, 177, 0.72);
  box-shadow: 0 0 0 1px rgba(91, 255, 177, 0.32), 0 16px 34px rgba(19, 128, 82, 0.24);
}

.media-room-video-tile.is-speaking {
  transform: translateY(-2px);
}

.media-room-video-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
}

.media-room-video-head strong,
.media-room-video-head span {
  grid-column: 1;
}

.media-room-video-tech {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  max-width: 44%;
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
  color: rgba(214, 228, 255, 0.72);
}

.media-room-camera-video {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
  object-fit: cover;
}

.media-room-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(11, 14, 24, 0.9);
  overflow: hidden;
}

.media-room-members {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.media-room-member-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.media-room-member-card.is-dominant {
  background: linear-gradient(180deg, rgba(31, 42, 74, 0.74), rgba(12, 17, 28, 0.94));
}

.media-room-member-card.is-speaking {
  background: linear-gradient(180deg, rgba(29, 58, 47, 0.62), rgba(13, 22, 20, 0.9));
}

.media-room-member-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.media-room-member-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.media-room-member-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.media-room-member-network {
  display: grid;
  gap: 4px;
}

.media-room-member-network-type {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(140, 191, 255, 0.84);
}

.media-room-member-network-meta {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(217, 228, 249, 0.74);
}

.media-room-volume-row {
  display: grid;
  gap: 8px;
  color: rgba(231, 239, 255, 0.84);
  font-size: 13px;
}

.media-room-volume-row input[type="range"] {
  width: 100%;
  accent-color: #7f98ff;
}

.media-room-member-actions {
  display: grid;
  gap: 8px;
}

.media-room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.media-room-actions .ghost-button,
.media-room-actions .danger-button {
  min-height: 44px;
  padding-inline: 16px;
}

.media-room-actions .ghost-button.is-active {
  background: rgba(98, 145, 255, 0.22);
  border-color: rgba(126, 179, 255, 0.42);
  color: #f6f9ff;
}

.media-room-actions #media-room-leave-button {
  margin-left: auto;
}

.media-room-video-grid::-webkit-scrollbar,
.media-room-members::-webkit-scrollbar,
.media-room-screen-strip::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.media-room-video-grid::-webkit-scrollbar-thumb,
.media-room-members::-webkit-scrollbar-thumb,
.media-room-screen-strip::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(195, 204, 229, 0.24);
}

@media (max-width: 980px) {
  .media-room-panel {
    width: calc(100vw - 22px);
    max-height: calc(100vh - 22px);
    padding: 14px;
    border-radius: 24px;
  }

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

  .media-room-side {
    max-height: 32vh;
  }

  .media-room-video-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .media-room-video-tile.is-dominant {
    grid-column: span 1;
    min-height: 220px;
  }
}

@media (max-width: 640px) {
  .media-call-bar,
  .media-call-incoming-banner {
    width: calc(100vw - 24px);
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 18px;
    flex-direction: column;
    align-items: stretch;
  }

  .media-call-bar-actions,
  .media-call-incoming-actions {
    justify-content: stretch;
  }

  .media-call-bar-actions > .ghost-button,
  .media-call-bar-actions > .danger-button,
  .media-call-incoming-actions > .primary-button,
  .media-call-incoming-actions > .ghost-button,
  .media-call-incoming-actions > .danger-button {
    flex: 1 1 100%;
  }

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

  .media-room-header-button {
    min-width: 38px;
    min-height: 38px;
    border-radius: 12px;
    font-size: 15px;
  }

  .media-room-header-button.is-pill .media-room-header-label {
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .media-room-overlay {
    align-items: stretch;
    padding: 0;
  }

  .media-room-panel {
    width: 100%;
    max-height: 100%;
    min-height: 100%;
    border-radius: 0;
    padding: 12px;
  }

  .media-room-waiting-avatar-shell {
    width: 132px;
    height: 132px;
  }

  .media-room-waiting-orbit-outer {
    width: 132px;
    height: 132px;
  }

  .media-room-waiting-orbit-inner {
    width: 104px;
    height: 104px;
  }

  .media-room-waiting-avatar {
    width: 84px;
    height: 84px;
    font-size: 28px;
  }

  .media-room-waiting-copy h3 {
    font-size: 26px;
  }

  .media-room-audio-hero-avatar {
    width: 112px;
    height: 112px;
    font-size: 40px;
  }

  .media-room-audio-hero-copy h3 {
    font-size: 28px;
  }

  .media-room-screen-stage,
  .media-room-screen-card {
    min-height: 220px;
  }

  .media-room-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .media-room-actions #media-room-leave-button {
    margin-left: 0;
    grid-column: 1 / -1;
  }
}
