:root {
  color-scheme: light;
  --bg-main: #f2f5f8;
  --bg-gradient: radial-gradient(circle at 12% 16%, #d2f7ff 0, #f2f5f8 42%, #e8edf6 100%);
  --card-bg: #ffffff;
  --line: #d7dde8;
  --text-main: #1a2436;
  --text-dim: #5f6c83;
  --teal: #0f8e82;
  --teal-hover: #0b786e;
  --danger: #c9364a;
  --shadow: 0 18px 40px rgba(18, 36, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: 'Space Grotesk', 'Avenir Next', 'Noto Sans', sans-serif;
}

h1,
h2,
h3,
p {
  margin: 0;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--text-main);
}

input,
button {
  font: inherit;
}

input[type='text'],
input[type='password'],
input[type='file'] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  background: #fff;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 44px;
}

.inline-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
  background: var(--teal);
  color: #fff;
}

button:hover {
  background: var(--teal-hover);
}

.field-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5f6c83;
  display: grid;
  place-items: center;
}

.field-toggle-btn:hover {
  background: transparent;
  color: #2e3f63;
}

.field-toggle-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 142, 130, 0.16);
}

.field-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: #2f4f85;
  text-align: left;
  text-decoration: underline;
  font-size: 13px;
  font-weight: 500;
}

.text-btn:hover {
  background: transparent;
  color: #1f3a6a;
}

.hidden {
  display: none !important;
}

.status-line {
  min-height: 22px;
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 14px;
}

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

.auth-body {
  min-height: 100vh;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(860px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card h1 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0.02em;
}

.auth-subtitle {
  margin-top: 8px;
  color: var(--text-dim);
}

.auth-mode-switch {
  margin-top: 18px;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  background: #edf3ff;
  border: 1px solid #d4e2f6;
  border-radius: 999px;
}

.auth-mode-btn {
  border: 0;
  background: transparent;
  color: #3b4f75;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
}

.auth-mode-btn.is-active {
  background: #ffffff;
  color: #1f3560;
  box-shadow: 0 4px 14px rgba(30, 62, 116, 0.14);
}

.auth-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.form-card {
  background: linear-gradient(165deg, #ffffff 0%, #f5f7fb 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.form-card h2 {
  font-size: 20px;
}

.chat-body {
  min-height: 100vh;
  display: grid;
  align-content: start;
  justify-items: center;
  padding: 14px 0 0;
}

.chat-body.chat-booting .chat-shell {
  opacity: 0;
  pointer-events: none;
}

.chat-shell.mobile-pane-boot-lock .chat-sidebar,
.chat-shell.mobile-pane-boot-lock .chat-main {
  transition: none !important;
}

.site-brand {
  width: 100%;
  display: flex;
  justify-content: center;
}

.site-brand img {
  display: block;
  width: min(300px, 100%);
  height: auto;
}

.site-brand-in-shell {
  padding: 2px 2px 4px;
}

.chat-shell {
  width: min(1200px, calc(100% - 26px));
  margin: 0 auto;
  min-height: calc(100vh - 28px);
  height: calc(100vh - 28px);
  max-height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  max-height: calc(100dvh - 28px);
  display: grid;
  grid-template-columns: 340px 1fr;
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-disabled-mode .chat-shell {
  width: min(520px, calc(100% - 26px));
  grid-template-columns: 1fr;
}

.chat-disabled-mode .chat-sidebar {
  border-right: 0;
  grid-template-rows: auto;
  align-content: start;
}

.chat-sidebar {
  border-right: 1px solid var(--line);
  padding: 16px;
  background: linear-gradient(178deg, #ffffff 0%, #eef5ff 100%);
  display: grid;
  grid-template-rows: auto auto auto auto auto auto auto 1fr;
  gap: 12px;
  min-height: 0;
}

.sidebar-pull-indicator {
  display: none;
}

.profile-pill {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
}

.profile-pill-clickable {
  cursor: pointer;
}

.profile-pill-clickable:hover {
  background: #f5f9ff;
}

.profile-pill-clickable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(65, 113, 191, 0.2);
}

.profile-meta {
  display: grid;
  gap: 2px;
}

.profile-meta strong {
  font-size: 15px;
}

.profile-meta span {
  color: var(--text-dim);
  font-size: 13px;
}

.notifications-preview {
  border: 1px solid #d7e3fb;
  border-radius: 12px;
  padding: 10px;
  background: #f2f7ff;
  display: grid;
  gap: 8px;
}

.notifications-preview h3 {
  font-size: 14px;
}

.sidebar-friend-add {
  border: 1px solid #d7e3fb;
  border-radius: 12px;
  padding: 10px;
  background: #f6f9ff;
  display: grid;
  gap: 8px;
}

.sidebar-friend-add h3 {
  font-size: 14px;
}

.send-icon-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 11px;
  font-size: 18px;
  line-height: 1;
}

.sidebar-fold {
  border: 1px solid #d7e3fb;
  border-radius: 12px;
  background: #f8fbff;
  overflow: hidden;
}

.sidebar-fold-toggle {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2d4065;
  text-align: left;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-fold-toggle:hover {
  background: #ecf3ff;
  color: #22365a;
}

.sidebar-fold-toggle.has-items {
  color: #0f8e82;
}

.sidebar-fold-panel {
  border-top: 1px solid #dbe6fb;
  padding: 10px;
  display: grid;
  gap: 8px;
  min-height: 0;
}

.sidebar-fold-panel .stack-row {
  padding: 8px;
}

#latest-notification-text {
  line-height: 1.4;
  min-height: 36px;
}

#latest-notification-text.is-clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 6px;
  margin: -4px -6px;
}

#latest-notification-text.is-clickable:hover {
  background: #edf3ff;
}

#latest-notification-text.is-clickable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(65, 113, 191, 0.2);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-header h2 {
  font-size: 19px;
}

.sidebar-chats-create-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border-radius: 10px;
  padding: 0;
  border: 1px solid #cddbf2;
  background: #ffffff;
  color: #2f4f85;
  font-size: 24px;
  line-height: 1;
  font-weight: 500;
}

.sidebar-chats-create-btn:hover {
  background: #edf4ff;
}

.sidebar-create-menu {
  position: fixed;
  left: 0;
  top: 0;
  right: auto;
  width: min(280px, calc(100vw - 20px));
  z-index: 13;
}

.friends-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  min-height: 120px;
}

.friend-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  position: relative;
}

.friend-row.has-menu {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.friend-row.clickable {
  cursor: pointer;
}

.friend-row.active {
  border-color: #8ca7dc;
  background: #eef4ff;
}

.friend-row.has-unread {
  border: 1px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, #8ee8b5 0%, #2ebf9f 55%, #5cd76f 100%) border-box;
  box-shadow: 0 8px 16px rgba(46, 191, 159, 0.16);
}

.friend-row.has-unread::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #18b679;
  box-shadow: 0 0 0 2px #fff;
}

.friend-row.has-menu.has-unread::after {
  right: 48px;
}

.friend-row.has-muted-unread {
  border: 1px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, #d9dde7 0%, #b8c0cf 55%, #c9d1de 100%) border-box;
  box-shadow: 0 8px 16px rgba(109, 122, 145, 0.2);
}

.friend-row.has-muted-unread::after {
  background: #8e98ab;
}

.favorite-row {
  border-color: #a8b7ff;
  background: linear-gradient(130deg, #eef3ff, #fcfdff);
  align-items: center;
}

.group-row {
  border-color: #b7d4f3;
  background: linear-gradient(132deg, #f3f9ff 0%, #ffffff 100%);
}

.favorite-row .friend-meta {
  align-content: center;
}

.favorite-row .friend-meta strong::before {
  content: '★ ';
  color: #f0ad2b;
}

.friend-meta {
  display: grid;
  gap: 2px;
}

.friend-meta strong {
  font-size: 14px;
}

.friend-meta span {
  font-size: 13px;
  color: var(--text-dim);
}

.friend-row-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  padding: 0;
  border: 1px solid #d4deef;
  background: #fff;
  color: #2f446b;
  font-size: 20px;
  line-height: 1;
}

.friend-row-menu-btn:hover {
  background: #edf3ff;
}

.chat-main {
  padding: 24px 24px 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  background: linear-gradient(150deg, #f8fcff 0%, #f0f4fc 100%);
  min-height: 0;
}

.chat-main-header {
  display: grid;
  gap: 8px;
}

.chat-main-header h1 {
  font-size: clamp(24px, 3vw, 36px);
}

.dialog-main-header {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.dialog-main-header.is-selecting {
  grid-template-columns: 1fr;
}

.message-selection-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #c8d9f2;
  border-radius: 12px;
  background: linear-gradient(155deg, #eef5ff 0%, #e8f1ff 100%);
}

.message-selection-bar strong {
  font-size: 14px;
  color: #274574;
}

.message-selection-actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.danger-inline {
  color: #a52c3f;
}

.dialog-peer-btn {
  width: fit-content;
  max-width: min(700px, 100%);
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.dialog-peer-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mobile-back-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #d2dff1;
  background: #ffffff;
  color: #2f4872;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  display: none;
  place-items: center;
}

.mobile-back-btn:hover {
  background: #edf3ff;
}

.dialog-peer-btn:hover {
  background: #eaf1fd;
}

.dialog-peer-meta {
  display: grid;
  gap: 2px;
}

.dialog-peer-meta strong {
  font-size: 16px;
}

.dialog-peer-meta span {
  color: var(--text-dim);
  font-size: 13px;
}

.dialog-peer-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4a628c;
  font-size: 13px;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.28;
  animation: typing-dot 0.96s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing-dot {
  0%,
  70%,
  100% {
    opacity: 0.24;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

.dialog-menu-wrap {
  position: relative;
  justify-self: end;
}

.kebab-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: #3b4d71;
  font-size: 22px;
  line-height: 1;
}

.kebab-btn:hover {
  background: #edf3ff;
}

.dialog-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 240px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(16, 28, 50, 0.18);
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 5;
  overflow-x: hidden;
  overflow-y: auto;
}

.group-member-action-menu {
  position: fixed;
  left: 0;
  right: auto;
  top: 0;
  width: 220px;
  z-index: 16;
}

.dialog-search-menu {
  position: fixed;
  right: 200px;
  top: 86px;
  width: min(360px, calc(100vw - 24px));
  z-index: 18;
  gap: 10px;
}

.dialog-search-label {
  font-size: 13px;
  color: #274574;
  font-weight: 600;
}

.dialog-search-input {
  width: 100%;
  border: 1px solid #c8d9f2;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  color: #1f365b;
  background: #f8fbff;
}

.dialog-search-input:focus {
  outline: none;
  border-color: #8db2e8;
  box-shadow: 0 0 0 3px rgba(89, 137, 211, 0.16);
}

.dialog-search-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dialog-search-counter {
  margin-right: auto;
  color: #4f6288;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-friend-menu {
  position: fixed;
  left: 0;
  right: auto;
  top: 0;
  width: 220px;
  z-index: 12;
}

.sidebar-group-menu {
  position: fixed;
  left: 0;
  right: auto;
  top: 0;
  width: 220px;
  z-index: 12;
}

.dialog-menu-item {
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: #24334f;
  font-size: 14px;
  font-weight: 500;
}

.dialog-menu-item:hover {
  background: #edf3ff;
}

.dialog-menu-item.danger {
  color: #a3293b;
}

.dialog-status {
  margin-top: 0;
}

.chat-main-header p {
  color: var(--text-dim);
  max-width: 660px;
}

.chat-placeholder {
  border: 1px dashed #9bb1d6;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  place-items: center;
  color: var(--text-dim);
  min-height: 300px;
}

.dialog-thread {
  position: relative;
  border: 1px solid #d8e3f7;
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fcff 0%, #f1f6ff 100%);
  overflow: hidden;
  min-height: 0;
  display: flex;
}

.dialog-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 18px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.dialog-scroll-bottom-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 999px;
  border: 1px solid #c5d5ef;
  background: rgba(255, 255, 255, 0.94);
  color: #34507e;
  padding: 0;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(24, 44, 79, 0.18);
  z-index: 3;
}

.dialog-new-messages-badge {
  position: absolute;
  right: 8px;
  bottom: 48px;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #7a8ee2;
  background: linear-gradient(155deg, #6f8dff 0%, #4f72e8 100%);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(28, 48, 101, 0.24);
  z-index: 4;
}

.dialog-scroll-bottom-btn:hover {
  background: #f2f7ff;
}

.dialog-scroll-bottom-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dialog-empty-messages {
  justify-self: center;
  align-self: center;
  margin-top: 18px;
  padding: 8px 12px;
  border-radius: 12px;
  color: #5f6c83;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #d9e4f8;
}

.dialog-date-divider {
  justify-self: center;
  align-self: center;
  margin: 6px 0 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  color: #5f6c83;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #d8e3f6;
  box-shadow: 0 2px 8px rgba(25, 45, 80, 0.08);
}

.message-row {
  display: flex;
  width: 100%;
}

.message-row.has-sender-meta {
  align-items: flex-end;
  gap: 8px;
}

.message-sender-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  margin-bottom: 2px;
  font-size: 10px;
}

.message-sender-avatar.is-clickable {
  cursor: pointer;
  touch-action: manipulation;
}

.message-sender-name {
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  color: #3e577f;
  font-weight: 700;
}

.message-sender-name.is-clickable {
  cursor: pointer;
  touch-action: manipulation;
}

.message-row.is-system {
  justify-content: center;
  margin: 2px 0;
}

.message-system-text {
  max-width: min(84%, 700px);
  text-align: center;
  font-size: 12px;
  color: #5f6f8c;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #d8e4f5;
  border-radius: 999px;
  padding: 5px 10px;
}

.message-row {
  transition: transform 140ms ease;
  will-change: transform;
}

.dialog-messages.is-selecting .message-row.is-selectable .message-bubble {
  cursor: pointer;
  position: relative;
}

.dialog-messages.is-selecting .message-row.is-selectable .message-bubble::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #91a9cc;
  background: rgba(255, 255, 255, 0.96);
}

.dialog-messages.is-selecting .message-row.is-selectable.is-selected .message-bubble::after {
  content: '✓';
  display: grid;
  place-items: center;
  color: #1f5ec4;
  font-size: 11px;
  font-weight: 700;
  border-color: #4f8bf2;
  background: #eef5ff;
}

.dialog-messages.is-selecting .message-row.is-selectable.is-selected .message-bubble {
  box-shadow:
    0 0 0 2px rgba(77, 137, 242, 0.35),
    0 8px 18px rgba(24, 44, 79, 0.14);
}

.message-row.is-reply-swipe-ready .message-bubble {
  box-shadow: 0 0 0 1px rgba(47, 117, 212, 0.2), 0 5px 14px rgba(24, 44, 79, 0.08);
}

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

.message-bubble {
  max-width: min(76%, 700px);
  min-width: 0;
  border-radius: 16px;
  padding: 10px 12px 8px;
  box-shadow: 0 5px 14px rgba(24, 44, 79, 0.08);
  display: grid;
  gap: 6px;
}

.message-bubble > * {
  min-width: 0;
  max-width: 100%;
}

.message-row.is-outgoing .message-bubble {
  background: linear-gradient(155deg, #d7f4e7 0%, #cbefdd 100%);
  border: 1px solid #b5e2cb;
  border-bottom-right-radius: 6px;
}

.message-row.is-incoming .message-bubble {
  background: #ffffff;
  border: 1px solid #d6e1f4;
  border-bottom-left-radius: 6px;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
  color: #1f2f4a;
  font-size: 14px;
}

.message-text p {
  margin: 0;
}

.message-text br {
  line-height: 1.35;
}

.message-text strong {
  font-weight: 700;
}

.message-text em {
  font-style: italic;
}

.message-text s {
  text-decoration-thickness: 1.5px;
}

.message-text a {
  color: #225fbe;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.message-row.is-outgoing .message-text a {
  color: #1b7a60;
}

.message-text code {
  display: inline;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 12px;
  background: rgba(27, 47, 82, 0.1);
  border-radius: 6px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-text pre {
  margin: 3px 0 0;
  max-width: 100%;
  box-sizing: border-box;
  background: #0b1220;
  color: #e6edf8;
  border: 1px solid #273a58;
  border-radius: 10px;
  padding: 30px 12px 11px;
  overflow: auto;
  white-space: pre;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 12px rgba(11, 18, 32, 0.24);
}

.message-text pre code {
  display: block;
  background: transparent !important;
  color: inherit !important;
  text-shadow: none;
  border-radius: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.46;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}

.message-text pre[class*='language-'] {
  background: #0b1220 !important;
  color: #e6edf8 !important;
  text-shadow: none !important;
}

.message-text code[class*='language-'] {
  background: transparent !important;
  color: inherit !important;
  text-shadow: none !important;
}

.message-text pre .token {
  background: transparent !important;
  text-shadow: none !important;
}

.message-text pre .token.comment,
.message-text pre .token.prolog,
.message-text pre .token.doctype,
.message-text pre .token.cdata {
  color: #8fa1be !important;
}

.message-text pre .token.punctuation {
  color: #d5ddea !important;
}

.message-text pre .token.property,
.message-text pre .token.tag,
.message-text pre .token.constant,
.message-text pre .token.symbol,
.message-text pre .token.deleted {
  color: #ff9eb0 !important;
}

.message-text pre .token.boolean,
.message-text pre .token.number {
  color: #f7c66b !important;
}

.message-text pre .token.selector,
.message-text pre .token.attr-name,
.message-text pre .token.string,
.message-text pre .token.char,
.message-text pre .token.builtin,
.message-text pre .token.inserted {
  color: #96e9a9 !important;
}

.message-text pre .token.operator,
.message-text pre .token.entity,
.message-text pre .token.url {
  color: #8ab9ff !important;
}

.message-text pre .token.atrule,
.message-text pre .token.attr-value,
.message-text pre .token.keyword {
  color: #bf9dff !important;
}

.message-text pre .token.function,
.message-text pre .token.class-name {
  color: #70dcff !important;
}

.message-text pre .token.regex,
.message-text pre .token.important,
.message-text pre .token.variable {
  color: #f6aa6f !important;
}

.message-text pre .token.important,
.message-text pre .token.bold {
  font-weight: 700;
}

.message-text pre .token.italic {
  font-style: italic;
}

.message-code-wrap {
  position: relative;
}

.message-code-copy-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 20px;
  min-width: 20px;
  border: 1px solid #3a5275;
  border-radius: 999px;
  background: rgba(18, 28, 45, 0.92);
  color: #d8e6ff;
  font-size: 11px;
  line-height: 1;
  padding: 0 9px;
  opacity: 0.88;
  transition: opacity 140ms ease, border-color 140ms ease, color 140ms ease;
}

.message-code-wrap:hover .message-code-copy-btn,
.message-code-copy-btn:focus-visible {
  opacity: 1;
}

.message-code-copy-btn:hover {
  border-color: #5f84ba;
  color: #ffffff;
}

.message-code-copy-btn.is-copied {
  border-color: #3f956a;
  color: #c7ffe3;
}

.message-code-copy-btn.is-error {
  border-color: #b0596b;
  color: #ffd6de;
}

.message-reply-preview {
  border-left: 3px solid #67a1ff;
  background: rgba(103, 161, 255, 0.12);
  border-radius: 9px;
  padding: 5px 8px;
  display: grid;
  gap: 2px;
}

.message-reply-preview.is-clickable {
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.message-reply-preview.is-clickable:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.message-row.is-outgoing .message-reply-preview {
  border-left-color: #33a47d;
  background: rgba(51, 164, 125, 0.16);
}

.message-reply-author {
  font-size: 12px;
  color: #2a4f87;
  font-weight: 700;
}

.message-row.is-outgoing .message-reply-author {
  color: #226f56;
}

.message-reply-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
  color: #44577b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-attachment {
  display: grid;
  gap: 8px;
  border: 1px solid #c8d9ef;
  border-radius: 12px;
  background: #f6f9ff;
  padding: 8px 10px;
  min-width: 0;
}

.message-row.is-outgoing .message-attachment {
  border-color: #b5e2cb;
  background: rgba(255, 255, 255, 0.52);
}

.message-attachment.is-media {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.message-attachment.is-file {
  grid-template-columns: 1fr;
}

.message-attachment-file-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.message-attachment-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.message-attachment-name {
  font-size: 13px;
  font-weight: 600;
  color: #2a3f63;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-row.is-outgoing .message-attachment-name {
  color: #245a47;
}

.message-attachment-size {
  font-size: 11px;
  color: #596a86;
}

.message-attachment-preview {
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #cadaf1;
  overflow: hidden;
  background: #ffffff;
  min-height: 56px;
  display: grid;
  place-items: center;
}

.message-row.is-outgoing .message-attachment-preview {
  border-color: #a8d8be;
}

.message-attachment.is-media .message-attachment-preview {
  min-height: 120px;
}

.message-attachment-preview-loading,
.message-attachment-preview-error {
  display: inline-block;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.message-attachment-preview-loading {
  color: #566a89;
}

.message-attachment-preview-error {
  color: #a0424f;
}

.message-attachment-image {
  display: block;
  width: 100%;
  max-height: min(52vh, 440px);
  object-fit: contain;
  background: #111a29;
}

.message-attachment-video {
  display: block;
  width: 100%;
  max-height: min(52vh, 440px);
  background: #101925;
}

.attachment-prefetch-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #bdd0ec;
  background: #ffffff;
  color: #2f4f84;
  display: grid;
  place-items: center;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.attachment-prefetch-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.1;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: relative;
  z-index: 2;
}

.attachment-prefetch-btn.is-loading {
  color: #1f7da9;
}

.attachment-prefetch-btn.is-loading::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, rgba(73, 170, 214, 0.15) 0%, #49aad6 70%, rgba(73, 170, 214, 0.15) 100%);
  animation: attachment-prefetch-spin 1.05s linear infinite;
}

.attachment-prefetch-btn.hidden {
  display: none !important;
}

.message-attachment.is-file.is-ready-download {
  cursor: pointer;
}

.message-attachment.is-file.is-ready-download:hover {
  border-color: #abc3e6;
  background: #eef5ff;
}

.message-row.is-outgoing .message-attachment.is-file.is-ready-download:hover {
  border-color: #a4d7bc;
  background: rgba(255, 255, 255, 0.72);
}

@keyframes attachment-prefetch-spin {
  to {
    transform: rotate(1turn);
  }
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.message-reaction-chip {
  border: 1px solid #cddbf4;
  background: #f6f9ff;
  color: #2f4369;
  border-radius: 999px;
  padding: 2px 8px;
  min-height: 24px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.message-reaction-chip:hover:not(:disabled) {
  background: #edf3ff;
  border-color: #b8cdef;
}

.message-reaction-chip.is-active {
  background: #dff0ff;
  border-color: #8bbbf4;
  color: #174281;
}

.message-reaction-chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.message-reaction-count {
  font-size: 11px;
  color: #4d6188;
}

.message-row.is-jump-highlight .message-bubble {
  animation: message-jump-highlight 1.25s ease;
}

.message-row.is-search-hit .message-bubble {
  box-shadow:
    0 0 0 1px rgba(39, 96, 178, 0.28),
    0 6px 14px rgba(28, 54, 96, 0.08);
}

.message-row.is-search-active .message-bubble {
  box-shadow:
    0 0 0 2px rgba(37, 111, 210, 0.62),
    0 0 0 5px rgba(37, 111, 210, 0.2),
    0 12px 24px rgba(20, 42, 78, 0.2);
  filter: saturate(1.08);
}

@keyframes message-jump-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(57, 125, 230, 0);
    filter: saturate(1);
  }
  22% {
    box-shadow:
      0 0 0 3px rgba(57, 125, 230, 0.56),
      0 0 0 7px rgba(57, 125, 230, 0.26),
      0 11px 24px rgba(20, 42, 78, 0.18);
    filter: saturate(1.12);
  }
  100% {
    box-shadow: 0 5px 14px rgba(24, 44, 79, 0.08);
    filter: saturate(1);
  }
}

.message-meta {
  justify-self: end;
  color: #5f6c83;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.message-meta-check {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  line-height: 1;
  vertical-align: middle;
}

.message-meta-check svg {
  width: 14px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.message-meta-check.is-read svg {
  width: 18px;
}

.message-meta-check.is-sent {
  color: #5f6c83;
}

.message-meta-check.is-read {
  color: #2f75d4;
}

.message-integrity {
  justify-self: start;
  font-size: 11px;
  color: #5f6c83;
}

.message-bubble.is-invalid-signature {
  border-color: #d7546d !important;
  box-shadow: 0 0 0 1px rgba(215, 84, 109, 0.15);
}

.message-bubble.is-unsigned {
  border-style: dashed;
}

.message-bubble.is-local-pending {
  opacity: 0.9;
}

.message-bubble.is-local-failed {
  border-color: #d7546d !important;
}

.message-failed-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.message-failed-btn {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  line-height: 1;
  font-size: 12px;
  background: #c22a42;
  color: #fff;
}

.message-failed-btn:hover {
  background: #a52036;
}

.dialog-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
  position: relative;
}

.dialog-reply-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
  border: 1px solid #c9daef;
  background: #f3f8ff;
  border-radius: 12px;
  padding: 7px 10px;
}

.dialog-attachment-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
  border: 1px solid #c9daef;
  background: #f3f8ff;
  border-radius: 12px;
  padding: 7px 10px;
}

.dialog-attachment-preview-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dialog-attachment-preview-meta strong {
  font-size: 12px;
  color: #2a5187;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-attachment-preview-meta span {
  font-size: 12px;
  color: #4c5f80;
}

.dialog-reply-preview-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dialog-reply-preview-meta strong {
  font-size: 12px;
  color: #2a5187;
}

.dialog-reply-preview-meta p {
  margin: 0;
  color: #4c5f80;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-reply-cancel-btn {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #cedced;
  background: #fff;
  color: #4b5d7b;
  line-height: 1;
  font-size: 15px;
  padding: 0;
}

.dialog-reply-cancel-btn:hover {
  background: #f1f5fc;
}

.dialog-attachment-cancel-btn {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #cedced;
  background: #fff;
  color: #4b5d7b;
  line-height: 1;
  font-size: 15px;
  padding: 0;
}

.dialog-attachment-cancel-btn:hover {
  background: #f1f5fc;
}

.dialog-compose textarea {
  width: 100%;
  min-height: 36px;
  max-height: 140px;
  resize: none;
  border: 1px solid #cbd8ee;
  border-radius: 14px;
  padding: 7px 2px 7px 11px;
  background: #fff;
  color: #1d2b44;
  line-height: 1.25;
  font-family: 'Avenir Next', 'Noto Sans', 'Segoe UI', sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  word-spacing: 0;
  overflow-y: hidden;
}

.dialog-compose textarea::placeholder {
  color: #8a98b2;
  text-indent: 0;
  line-height: 1.25;
}

.dialog-compose-actions {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.dialog-compose-actions button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  padding: 0;
  font-size: 18px;
}

.dialog-emoji-btn {
  background: #eef3ff;
  color: #2f466f;
  border: 1px solid #cad8ee;
}

.dialog-attach-btn {
  background: #eef3ff;
  color: #2f466f;
  border: 1px solid #cad8ee;
}

.dialog-attach-btn:hover:not(:disabled) {
  background: #dde7fb;
}

.dialog-emoji-btn:hover:not(:disabled) {
  background: #dde7fb;
}

.dialog-compose-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dialog-compose.is-disabled {
  opacity: 0.76;
}

.dialog-compose.is-disabled textarea {
  background: #edf1f8;
  color: #66748f;
  cursor: not-allowed;
}

.dialog-compose.is-disabled .dialog-compose-actions button {
  background: #d9e2f3;
  color: #6d7f9d;
  border-color: #d1dbed;
}

.dialog-compose.is-disabled .dialog-compose-actions button:disabled {
  opacity: 1;
}

.emoji-picker-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(340px, calc(100vw - 32px));
  border: 1px solid #cdd8ea;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(31, 46, 76, 0.2);
  padding: 10px;
  z-index: 24;
}

.emoji-picker-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.emoji-picker-tab {
  height: 28px;
  min-width: 46px;
  padding: 0 9px;
  border-radius: 9px;
  border: 1px solid #d2dcef;
  background: #f5f8ff;
  color: #2f466f;
  font-size: 12px;
  font-weight: 600;
}

.emoji-picker-tab:hover {
  background: #e8efff;
}

.emoji-picker-tab.is-active {
  background: #dfe9ff;
  border-color: #9cb7ea;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.emoji-item-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  padding: 0;
  line-height: 1;
  font-size: 19px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.emoji-item-btn:hover {
  background: #edf3ff;
  border-color: #cad8ef;
}

.dialog-menu.failed-message-menu,
.dialog-menu.message-actions-menu,
.dialog-menu.confirm-action-menu,
.dialog-menu.message-reaction-menu,
.dialog-menu.message-readers-menu,
.dialog-menu.message-reaction-users-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  width: min(220px, calc(100vw - 24px));
  z-index: 16;
}

.dialog-menu.message-actions-menu {
  width: min(252px, calc(100vw - 24px));
}

.dialog-menu.confirm-action-menu {
  width: min(280px, calc(100vw - 24px));
  padding: 10px;
  gap: 8px;
  z-index: 18;
}

.dialog-menu.forward-target-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  width: min(300px, calc(100vw - 24px));
  z-index: 18;
  padding: 10px;
  gap: 8px;
}

.dialog-menu.message-reaction-menu {
  width: min(268px, calc(100vw - 24px));
  z-index: 18;
  padding: 10px;
}

.dialog-menu.message-readers-menu {
  width: min(320px, calc(100vw - 24px));
  z-index: 18;
  padding: 10px;
  gap: 8px;
}

.dialog-menu.message-reaction-users-menu {
  width: min(320px, calc(100vw - 24px));
  z-index: 18;
  padding: 10px;
  gap: 8px;
}

.message-reaction-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 6px;
  max-height: min(54vh, 340px);
  overflow: auto;
}

.message-reaction-btn {
  min-width: 34px;
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid #cad6ec;
  background: #f8fbff;
  color: #20385f;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.message-reaction-btn:hover {
  background: #ecf3ff;
  border-color: #b7c9e7;
}

.message-reaction-btn.is-active {
  background: #dff0ff;
  border-color: #8bbbf4;
}

.message-readers-list {
  display: grid;
  gap: 8px;
  max-height: min(calc(5 * 56px + 4 * 8px), calc(100vh - 220px));
  overflow: auto;
}

.message-readers-empty {
  margin: 0;
  font-size: 13px;
  color: #5f6f8c;
}

.message-readers-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 8px;
  border: 1px solid #d6e2f3;
  border-radius: 10px;
  background: #f8fbff;
}

.message-readers-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.message-readers-meta strong {
  font-size: 13px;
}

.message-readers-meta span {
  font-size: 12px;
  color: #5f6f8c;
}

.message-readers-time {
  font-size: 11px;
  color: #4f6385;
  font-variant-numeric: tabular-nums;
}

.message-actions-reactions-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  border: 1px solid #d7e3f6;
  border-radius: 10px;
  background: #f5f9ff;
  padding: 5px;
  margin-bottom: 2px;
}

.message-actions-reactions-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.message-actions-reactions-list::-webkit-scrollbar {
  height: 6px;
}

.message-actions-reaction-btn {
  min-width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #1f3559;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.message-actions-reaction-btn:hover {
  background: #e8f1ff;
  border-color: #c2d6f2;
}

.message-actions-reaction-btn.is-active {
  background: #dcf0ff;
  border-color: #8ebaf0;
}

.message-actions-open-all-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #cad6ea;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  background: #ffffff;
  color: #445b81;
}

.message-actions-open-all-btn:hover {
  background: #edf3ff;
  border-color: #bacbea;
}

.forward-target-title {
  margin: 0;
  font-size: 13px;
  color: #42577d;
}

.forward-target-list {
  display: grid;
  gap: 4px;
  max-height: min(calc(5 * 40px + 4 * 4px), calc(100vh - 220px));
  overflow: auto;
}

.confirm-action-text {
  margin: 0;
  color: #2b3d5f;
  font-size: 13px;
  line-height: 1.35;
}

.confirm-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.dialog-encryption-note {
  margin-top: -2px;
}

.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #6dc6d4, #5476c8);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-transform: uppercase;
}

.avatar-badge.avatar-xl {
  width: 120px;
  height: 120px;
  font-size: 34px;
}

.avatar-badge.has-image {
  background: #fff;
}

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

.avatar-badge.is-clickable {
  cursor: pointer;
}

.ghost-btn {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--line);
}

.ghost-btn:hover {
  background: #f5f8ff;
}

.tiny-btn {
  padding: 7px 10px;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 27, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 18px;
  position: relative;
  display: grid;
  gap: 16px;
}

.recover-modal-card {
  width: min(520px, 100%);
}

.recovery-codes-card {
  width: min(520px, 100%);
}

.peer-profile-card {
  width: min(420px, 100%);
}

.group-profile-card {
  width: min(560px, 100%);
}

.group-profile-title-edit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.group-add-members-card {
  width: min(520px, 100%);
}

.notifications-modal-card {
  width: min(640px, 100%);
}

.create-group-card {
  width: min(520px, 100%);
}

.create-group-form {
  gap: 12px;
}

.create-group-avatar-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.create-group-avatar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.create-group-friends-list {
  border: 1px solid #d7e3f6;
  border-radius: 12px;
  padding: 10px;
  max-height: min(38vh, 280px);
  overflow: auto;
  display: grid;
  gap: 8px;
  background: #fbfdff;
}

.group-profile-section {
  display: grid;
  gap: 8px;
}

.group-profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.group-profile-members-list {
  max-height: min(36vh, 280px);
}

.group-profile-member-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #deebfb;
  border-radius: 10px;
  padding: 6px 8px;
  background: #ffffff;
}

.group-profile-member-meta {
  display: grid;
  gap: 2px;
}

.group-profile-member-meta strong {
  font-size: 13px;
}

.group-profile-member-meta span {
  font-size: 12px;
  color: var(--text-dim);
}

.create-group-friend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #deebfb;
  border-radius: 10px;
  padding: 6px 8px;
  background: #ffffff;
}

.create-group-friend-row label {
  display: block;
  margin: 0;
  font-size: 13px;
}

.create-group-friend-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.media-viewer-modal {
  background: rgba(6, 10, 18, 0.82);
  z-index: 18;
}

.media-viewer-card {
  width: min(1100px, 100%);
  max-height: calc(100vh - 24px);
  padding: 44px 14px 14px;
  background: #0b111d;
  border-color: #243754;
}

.media-viewer-close-btn {
  top: 8px;
  right: 8px;
  background: rgba(239, 243, 250, 0.92);
}

.media-viewer-content {
  min-height: 240px;
  max-height: calc(100vh - 110px);
  display: grid;
  place-items: center;
  overflow: auto;
}

.media-viewer-image,
.media-viewer-video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 130px);
  border-radius: 10px;
  background: #050a12;
}

.media-viewer-video {
  width: min(100%, 940px);
}

.media-viewer-loading,
.media-viewer-error {
  color: #d4deef;
  font-size: 14px;
}

.media-viewer-error {
  color: #ffafbc;
}

.notification-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.notification-row.unread {
  border-color: #7f9fdb;
  background: linear-gradient(180deg, #edf3ff 0%, #f8fbff 100%);
}

.notification-row.clickable {
  cursor: pointer;
}

.notification-row.clickable:hover {
  border-color: #7392cb;
}

.notification-row.clickable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(65, 113, 191, 0.2);
}

.notification-row.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0f8e82;
  margin-top: 8px;
}

.notification-avatar {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.notification-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.notification-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.notification-title {
  font-size: 14px;
  line-height: 1.35;
}

.notification-time {
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}

.notification-subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
}

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

.notification-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
}

.notification-icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.notification-icon-accept {
  background: #0f8e82;
}

.notification-icon-accept:hover:not(:disabled) {
  background: #0a756b;
}

.notification-icon-reject {
  background: #eef3ff;
  color: #30456f;
  border: 1px solid #cad8ee;
}

.notification-icon-reject:hover:not(:disabled) {
  background: #dde7fb;
}

.notification-icon-block {
  background: #b22a3f;
}

.notification-icon-block:hover:not(:disabled) {
  background: #922235;
}

.notification-icon-read {
  background: #eef3ff;
  color: #30456f;
  border: 1px solid #cad8ee;
}

.notification-icon-read:hover:not(:disabled) {
  background: #dde7fb;
}

.notification-read-btn {
  height: 30px;
  border-radius: 9px;
  border: 1px solid #cad8ee;
  background: #eef3ff;
  color: #30456f;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 600;
}

.notification-read-btn:hover:not(:disabled) {
  background: #dde7fb;
}

.peer-profile-body {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.peer-profile-body strong {
  font-size: 20px;
}

.peer-profile-body span {
  color: var(--text-dim);
  font-size: 14px;
}

.peer-security-section {
  margin-top: 12px;
}

.peer-security-section h3 {
  margin: 0;
}

.peer-safety-status.is-warning,
.peer-identity-history-status.is-warning {
  color: #a3293b;
}

.peer-history-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8fbff;
  display: grid;
  gap: 4px;
}

.peer-history-row strong {
  font-size: 14px;
}

.peer-history-row code {
  font-size: 12px;
  word-break: break-all;
}

.recovery-codes-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.icon-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #eff3fa;
  color: #34425f;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.icon-btn:hover {
  background: #dde7f5;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-right: 42px;
}

.modal-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.sound-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sound-settings-row .mini-muted {
  margin: 0;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.settings-form {
  display: grid;
  gap: 12px;
}

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

.stack-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tiny-action {
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.ghost-action {
  background: #eef3ff;
  color: #2e3f63;
}

.ghost-action:hover {
  background: #dfe8fb;
}

.danger-action {
  background: #bd3348;
}

.danger-action:hover {
  background: #99283a;
}

.mini-muted {
  color: var(--text-dim);
  font-size: 13px;
}

.avatar-picker-wrap {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.avatar-picker-core {
  position: relative;
}

.avatar-pick-btn {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  padding: 6px;
  background: #f1f6ff;
  border: 1px solid #cfdcf5;
}

.avatar-pick-btn:hover {
  background: #e6f0ff;
}

.avatar-reset-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  background: #fff;
  color: #b32036;
  border: 1px solid #f0b8c0;
}

.avatar-reset-btn:hover {
  background: #ffeef1;
}

.picker-hint {
  color: var(--text-dim);
  font-size: 13px;
}

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

.modal-footer-actions {
  position: sticky;
  bottom: -18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid #e2e8f3;
  background: linear-gradient(to top, #ffffff 80%, rgba(255, 255, 255, 0));
}

.danger-btn {
  background: var(--danger);
}

.danger-btn:hover {
  background: #a72739;
}

.modal-status {
  margin-top: 0;
}

@media (max-width: 920px) {
  .chat-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    height: auto;
    max-height: none;
  }

  .chat-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chat-main {
    padding: 18px;
  }
}

@media (max-width: 820px) {
  .modal {
    padding:
      max(8px, env(safe-area-inset-top, 0px))
      max(8px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px));
    align-items: stretch;
  }

  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(var(--ma-vv-height, 100svh) - 16px);
    border-radius: 14px;
    padding: 14px;
    gap: 12px;
    overflow-x: hidden;
  }

  .modal-head {
    padding-right: 38px;
  }

  .modal-section {
    min-width: 0;
    padding: 10px;
    gap: 10px;
  }

  .modal-section > * {
    min-width: 0;
  }

  .media-viewer-modal {
    padding: 0;
  }

  .media-viewer-card {
    width: 100%;
    max-width: 100%;
    height: var(--ma-vv-height, 100svh);
    max-height: var(--ma-vv-height, 100svh);
    border-radius: 0;
    border: 0;
    padding: calc(40px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .media-viewer-content {
    max-height: calc(var(--ma-vv-height, 100svh) - 60px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .media-viewer-image,
  .media-viewer-video {
    max-height: calc(var(--ma-vv-height, 100svh) - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .stack-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .stack-row > :last-child {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

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

  .modal-actions > button {
    width: 100%;
  }

  .modal-footer-actions {
    bottom: -14px;
    margin: 0 -14px -14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, #ffffff 86%, rgba(255, 255, 255, 0));
    z-index: 2;
  }

  .otp-code {
    flex-wrap: wrap;
  }

  .auth-twofa-code {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 6px;
  }

  .twofa-qr-image {
    width: min(180px, 58vw);
    height: min(180px, 58vw);
  }

  .chat-body {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    height: 100vh;
    height: 100svh;
    padding: 0;
    overflow: hidden;
  }

  .chat-shell {
    position: fixed;
    top: var(--ma-vv-top, 0px);
    left: 0;
    right: 0;
    width: 100%;
    min-height: var(--ma-vv-height, 100svh);
    height: var(--ma-vv-height, 100svh);
    max-height: var(--ma-vv-height, 100svh);
    margin: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }

  .chat-shell.is-mobile-layout {
    display: block;
    position: relative;
    overflow: hidden;
  }

  .chat-shell.is-mobile-layout .chat-sidebar,
  .chat-shell.is-mobile-layout .chat-main {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    transition: transform 240ms ease, opacity 220ms ease;
    will-change: transform, opacity;
  }

  .chat-shell.is-mobile-layout .chat-sidebar {
    border-right: 0;
    border-bottom: 0;
    display: block;
    padding: 12px 12px calc(42px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 2;
  }

  .chat-shell.is-mobile-layout .chat-sidebar > * + * {
    margin-top: 12px;
  }

  .chat-shell.is-mobile-layout .chat-sidebar .sidebar-pull-indicator {
    display: grid;
    place-items: center;
    position: sticky;
    top: 2px;
    z-index: 4;
    height: 0;
    margin: 0;
    overflow: visible;
    opacity: 0;
    transform: translateY(calc(-12px + var(--ma-sidebar-pull-distance, 0px) * 0.18));
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
  }

  .chat-shell.is-mobile-layout .chat-sidebar .sidebar-pull-spinner {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid #c7d7ef;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 6px 14px rgba(43, 72, 118, 0.16);
    display: grid;
    place-items: center;
  }

  .chat-shell.is-mobile-layout .chat-sidebar .sidebar-pull-spinner svg {
    width: 18px;
    height: 18px;
    stroke: #2a629f;
    fill: none;
    stroke-width: 2.15;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: rotate(calc(var(--ma-sidebar-pull-progress, 0) * 180deg));
    opacity: calc(0.58 + var(--ma-sidebar-pull-progress, 0) * 0.42);
    transition: transform 120ms ease, opacity 120ms ease;
  }

  .chat-shell.is-mobile-layout .chat-sidebar.is-pulling .sidebar-pull-indicator,
  .chat-shell.is-mobile-layout .chat-sidebar.is-refreshing .sidebar-pull-indicator,
  .chat-shell.is-mobile-layout .chat-sidebar.is-pull-ready .sidebar-pull-indicator {
    opacity: 1;
  }

  .chat-shell.is-mobile-layout .chat-sidebar.is-pull-ready .sidebar-pull-spinner {
    border-color: #94bcf2;
  }

  .chat-shell.is-mobile-layout .chat-sidebar.is-refreshing .sidebar-pull-spinner svg {
    animation: sidebar-pull-spin 0.78s linear infinite;
    opacity: 1;
  }

  .chat-shell.is-mobile-layout .chat-main {
    z-index: 3;
    padding: 0;
    gap: 0;
    overflow: hidden;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    height: 100%;
  }

  .chat-shell.is-mobile-layout .chat-main-header {
    position: sticky;
    top: 0;
    z-index: 7;
    padding: 6px 10px 6px;
    border-bottom: 1px solid #dce6f7;
    background: #f8fcff;
  }

  .chat-shell.is-mobile-layout.mobile-view-list .chat-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .chat-shell.is-mobile-layout.mobile-view-list .chat-main {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
  }

  .chat-shell.is-mobile-layout.mobile-view-chat .chat-sidebar {
    transform: translateX(-18%);
    opacity: 0;
    pointer-events: none;
  }

  .chat-shell.is-mobile-layout.mobile-view-chat .chat-main {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .chat-shell.is-mobile-layout.mobile-view-chat .mobile-back-btn {
    display: grid;
  }

  .chat-shell.is-mobile-layout .dialog-main-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'selection selection'
      'peer menu';
    align-items: center;
    column-gap: 8px;
    row-gap: 6px;
  }

  .chat-shell.is-mobile-layout .message-selection-bar {
    grid-area: selection;
    width: 100%;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    padding: 6px 8px;
    border-radius: 10px;
  }

  .chat-shell.is-mobile-layout .message-selection-bar strong {
    font-size: 12px;
    white-space: nowrap;
  }

  .chat-shell.is-mobile-layout .message-selection-actions {
    min-width: 0;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .chat-shell.is-mobile-layout .message-selection-actions .tiny-btn {
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .chat-shell.is-mobile-layout .dialog-peer-head {
    grid-area: peer;
    min-width: 0;
    max-width: 100%;
  }

  .chat-shell.is-mobile-layout .dialog-menu-wrap {
    grid-area: menu;
    align-self: center;
  }

  .chat-shell.is-mobile-layout .dialog-peer-btn {
    max-width: 100%;
    min-width: 0;
    padding: 4px 6px;
  }

  .chat-shell.is-mobile-layout .dialog-thread {
    min-height: 0;
    height: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .chat-shell.is-mobile-layout .dialog-messages {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 8px 6px;
  }

  .chat-shell.is-mobile-layout .dialog-compose {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .chat-shell.is-mobile-layout .dialog-reply-preview {
    grid-column: 1 / -1;
  }

  .chat-shell.is-mobile-layout .dialog-compose textarea {
    grid-column: 1;
    min-height: 40px;
    max-height: 128px;
    padding: 8px 2px 8px 11px;
  }

  .chat-shell.is-mobile-layout .dialog-compose-actions {
    grid-column: 2;
    justify-content: flex-end;
    gap: 6px;
    align-self: end;
  }

  .chat-shell.is-mobile-layout .dialog-compose-actions button {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .chat-shell.is-mobile-layout .message-row {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .chat-shell.is-mobile-layout .message-row.has-sender-meta {
    gap: 6px;
    align-items: flex-end;
  }

  .chat-shell.is-mobile-layout .message-sender-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 9px;
  }

  .chat-shell.is-mobile-layout .message-sender-name {
    font-size: 11px;
  }

  .chat-shell.is-mobile-layout .message-row.is-incoming {
    justify-content: flex-start;
  }

  .chat-shell.is-mobile-layout .message-row.is-outgoing {
    justify-content: flex-end;
  }

  .chat-shell.is-mobile-layout .message-bubble {
    width: auto;
    max-width: min(74vw, calc(100% - 34px));
    min-width: 0;
    border-radius: 14px;
    padding: 7px 9px 6px;
    gap: 4px;
    box-sizing: border-box;
  }

  .chat-shell.is-mobile-layout .message-row.is-outgoing .message-bubble {
    margin: 0;
  }

  .chat-shell.is-mobile-layout .message-row.is-incoming .message-bubble {
    margin: 0;
  }

  .chat-shell.is-mobile-layout .message-text {
    font-size: 13px;
    line-height: 1.35;
    max-width: 100%;
    min-width: 0;
  }

  .chat-shell.is-mobile-layout .message-text,
  .chat-shell.is-mobile-layout .message-text code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .chat-shell.is-mobile-layout .message-text pre {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .chat-shell.is-mobile-layout .message-code-block,
  .chat-shell.is-mobile-layout .message-text pre[class*='language-'] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .chat-shell.is-mobile-layout .message-text pre code {
    max-width: 100%;
    min-width: 0;
  }

  .chat-shell.is-mobile-layout .message-meta {
    font-size: 10px;
  }

  .chat-shell.is-mobile-layout .message-reply-preview {
    padding: 4px 7px;
    gap: 1px;
  }

  .chat-shell.is-mobile-layout .message-reply-author,
  .chat-shell.is-mobile-layout .message-reply-text {
    font-size: 11px;
  }

  .chat-shell.is-mobile-layout .message-attachment {
    padding: 7px 8px;
    gap: 6px;
  }

  .chat-shell.is-mobile-layout .message-attachment.is-media {
    padding: 0;
  }

  .chat-shell.is-mobile-layout .message-attachment-name {
    font-size: 12px;
  }

  .chat-shell.is-mobile-layout .message-attachment-size {
    font-size: 10px;
  }

  .chat-shell.is-mobile-layout .attachment-prefetch-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .chat-shell.is-mobile-layout .friends-list {
    min-height: 0;
    overflow: visible;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .chat-shell.is-mobile-layout .friends-list::after {
    content: '';
    display: block;
    height: calc(34px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
  }

  .chat-shell.is-mobile-layout .sidebar-header {
    align-items: center;
  }

  .chat-shell.is-mobile-layout .sidebar-chats-create-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    font-size: 22px;
  }

  .chat-shell.is-mobile-layout .dialog-encryption-note {
    display: none;
  }

  .dialog-search-menu {
    right: 13px;
    top: 74px;
    width: min(420px, calc(100vw - 20px));
  }
}

@keyframes sidebar-pull-spin {
  to {
    transform: rotate(1turn);
  }
}

@media (hover: none) {
  .message-code-copy-btn {
    opacity: 1;
  }
}

@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  .chat-shell.is-mobile-layout .chat-sidebar,
  .chat-shell.is-mobile-layout .chat-main {
    transition: none;
  }
}

@media (max-width: 680px) {
  .auth-card {
    padding: 18px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .stack-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .avatar-badge.avatar-xl {
    width: 96px;
    height: 96px;
    font-size: 28px;
  }

  .avatar-pick-btn {
    width: 108px;
    height: 108px;
  }

  .notification-row {
    grid-template-columns: auto 1fr;
  }

  .notification-dot {
    display: none;
  }

  .dialog-messages {
    min-height: 0;
    padding: 10px;
  }

  .chat-shell:not(.is-mobile-layout) .message-bubble {
    max-width: 88%;
  }

  .chat-shell:not(.is-mobile-layout) .dialog-compose {
    grid-template-columns: 1fr;
  }

  .chat-shell:not(.is-mobile-layout) .dialog-compose-actions {
    justify-content: flex-end;
  }
}

.auth-twofa {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: linear-gradient(165deg, #ffffff 0%, #f5f7fb 100%);
}

.auth-twofa-form {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.auth-twofa-code {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-twofa-separator {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #b8c4d8;
  margin: 0 2px;
}

.auth-twofa-form .login-2fa-digit {
  width: 46px;
  height: 58px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #c9d5ea;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.auth-twofa-form .login-2fa-digit:focus {
  outline: none;
  border-color: #0f8e82;
  box-shadow: 0 0 0 3px rgba(15, 142, 130, 0.14);
}

.auth-twofa-form .login-2fa-digit:disabled {
  background: #f1f4f9;
  color: #8c95a8;
}

.security-stack {
  display: grid;
  gap: 8px;
}

.secret-code {
  display: block;
  width: 100%;
  overflow-x: auto;
  padding: 8px 10px;
  border: 1px dashed #b6c5df;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 13px;
}

.mini-link {
  color: #2f4f85;
  font-size: 13px;
  text-decoration: underline;
}

.otp-form {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.otp-code {
  display: flex;
  align-items: center;
  gap: 6px;
}

.otp-separator {
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: #b8c4d8;
  margin: 0 2px;
}

.otp-form .otp-digit {
  width: 42px;
  height: 50px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #c9d5ea;
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.otp-form .otp-digit:focus {
  outline: none;
  border-color: #0f8e82;
  box-shadow: 0 0 0 3px rgba(15, 142, 130, 0.14);
}

.otp-form .otp-digit:disabled {
  background: #f1f4f9;
  color: #8c95a8;
}

.inline-form-compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.inline-form-compact input[name='username'] {
  min-width: 0;
}

.session-row {
  grid-template-columns: 1fr auto;
}

.session-meta {
  display: grid;
  gap: 2px;
}

.session-meta strong {
  font-size: 14px;
}

.session-meta span {
  color: var(--text-dim);
  font-size: 12px;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 999px;
  background: #e8fff1;
  color: #1f7a4b;
  border: 1px solid #bde5cb;
}

@media (max-width: 680px) {
  .inline-form-compact {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .auth-twofa-code {
    gap: 4px;
  }

  .auth-twofa-form .login-2fa-digit {
    width: 34px;
    height: 46px;
    font-size: 22px;
  }

  .auth-twofa-separator {
    width: 8px;
    margin: 0 1px;
  }

  .otp-form .otp-digit {
    width: 36px;
    height: 46px;
    font-size: 24px;
  }

  .otp-separator {
    width: 8px;
  }
}

@media (max-width: 380px) {
  .auth-twofa-code {
    gap: 3px;
  }

  .auth-twofa-form .login-2fa-digit {
    width: 30px;
    height: 42px;
    font-size: 20px;
  }

  .auth-twofa-separator {
    width: 6px;
    margin: 0;
  }
}

.twofa-instructions {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  line-height: 1.4;
}

.twofa-qr-wrap {
  display: flex;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.twofa-qr-image {
  width: 220px;
  height: 220px;
  object-fit: contain;
  image-rendering: crisp-edges;
}

@media (max-width: 680px) {
  .twofa-qr-image {
    width: 180px;
    height: 180px;
  }
}
