:root {
  color-scheme: light;
  --app-height: 100dvh;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --bar: rgba(249, 249, 251, 0.86);
  --line: #d8d8df;
  --line-strong: #c7c7cc;
  --text: #111827;
  --muted: #6b7280;
  --accent: #007aff;
  --accent-dark: #0062cc;
  --danger: #b42318;
  --mine: #007aff;
  --theirs: #ffffff;
  --field: #ffffff;
  --field-muted: #eef0f4;
  --list-surface: #ffffff;
  --notice-bg: #fff7ed;
  --notice-text: #8a4b12;
  --shadow: 0 16px 40px rgba(17, 24, 39, 0.09);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", sans-serif;
}

body.theme-dark-active {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #11161d;
  --bar: rgba(17, 22, 29, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f7fb;
  --muted: #9aa4b2;
  --accent: #0a84ff;
  --accent-dark: #64b5ff;
  --danger: #ff6961;
  --mine: #0a84ff;
  --theirs: #202832;
  --field: #1b222c;
  --field-muted: #222a35;
  --list-surface: #151b23;
  --notice-bg: rgba(255, 159, 10, 0.18);
  --notice-text: #ffd08a;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

body.theme-dark-active .auth-view {
  background: linear-gradient(180deg, #0b0f14 0%, #111820 100%);
}

body.theme-dark-active .auth-panel,
body.theme-dark-active .modal-panel,
body.theme-dark-active .chat-view,
body.theme-dark-active .conversation,
body.theme-dark-active .secondary-button,
body.theme-dark-active .load-more {
  background: var(--surface);
}

body.theme-dark-active input,
body.theme-dark-active select,
body.theme-dark-active textarea,
body.theme-dark-active .composer textarea {
  border-color: var(--line-strong);
  background: var(--field);
  color: var(--text);
}

body.theme-dark-active input::placeholder,
body.theme-dark-active textarea::placeholder {
  color: #788392;
}

body.theme-dark-active .icon-button {
  border-color: var(--line);
  background: rgba(36, 44, 55, 0.82);
  color: var(--text);
}

body.theme-dark-active .search-box,
body.theme-dark-active .dialog-filters {
  background: var(--surface);
}

body.theme-dark-active .search-box input,
body.theme-dark-active .dialog-filters button {
  background: var(--field-muted);
  color: var(--muted);
}

body.theme-dark-active .dialog-filters button.active {
  background: var(--accent);
  color: #fff;
}

body.theme-dark-active .dialog-list,
body.theme-dark-active .dialog-button,
body.theme-dark-active .new-chat-result .dialog-button,
body.theme-dark-active .session-row,
body.theme-dark-active .telegram-device-row,
body.theme-dark-active .user-row,
body.theme-dark-active .audit-row,
body.theme-dark-active .status-item {
  background: var(--list-surface);
}

body.theme-dark-active .dialog-button:hover,
body.theme-dark-active .dialog-button.active {
  background: #142a44;
}

body.theme-dark-active .dialog-button.muted .dialog-title,
body.theme-dark-active .dialog-preview,
body.theme-dark-active .dialog-date,
body.theme-dark-active .current-user,
body.theme-dark-active .status-label,
body.theme-dark-active .user-row span,
body.theme-dark-active .audit-row span {
  color: var(--muted);
}

body.theme-dark-active .current-user {
  background: var(--field-muted);
}

body.theme-dark-active .message-list {
  background:
    radial-gradient(circle at 18% 18%, rgba(10, 132, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #0d1218 0%, #11161d 74%);
}

body.theme-dark-active .message:not(.mine) .bubble {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--theirs);
  color: var(--text);
}

body.theme-dark-active .bubble-time {
  color: rgba(154, 164, 178, 0.82);
}

body.theme-dark-active .reply-chip {
  background: rgba(10, 132, 255, 0.16);
  color: #8ac5ff;
}

body.theme-dark-active .pinned-message-bar {
  background: rgba(17, 22, 29, 0.94);
}

body.theme-dark-active .date-divider {
  background: rgba(154, 164, 178, 0.16);
  color: #b2bcc9;
}

body.theme-dark-active .composer,
body.theme-dark-active .chat-header,
body.theme-dark-active .topbar {
  border-color: var(--line);
  background: var(--bar);
}

body.theme-dark-active .action-sheet button {
  background: rgba(32, 40, 50, 0.94);
  color: #7cc0ff;
}

body.theme-dark-active .action-sheet-info {
  background: rgba(32, 40, 50, 0.94);
  color: var(--text);
}

body.theme-dark-active .action-sheet .action-cancel {
  color: var(--text);
}

body.theme-dark-active .jump-bottom {
  border-color: var(--line);
  background: rgba(32, 40, 50, 0.9);
  color: #7cc0ff;
}

body.theme-dark-active .danger-button {
  border-color: rgba(255, 105, 97, 0.32);
  background: rgba(255, 105, 97, 0.12);
  color: #ff9b95;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 650;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hidden {
  display: none !important;
}

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

.app-shell {
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  max-height: var(--app-height);
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
}

.auth-view {
  min-height: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f5fbfa 100%);
}

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

.brand-row h1 {
  font-size: 21px;
  line-height: 1.2;
}

.brand-row p,
.topbar p,
.chat-header p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 4px;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

select {
  min-height: 40px;
  padding: 0 34px 0 10px;
}

textarea {
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.error-text {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
}

.chat-view {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.app-notice {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff7ed;
  color: #8a4b12;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.app-notice button {
  width: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 50%;
  background: rgba(138, 75, 18, 0.1);
  color: #8a4b12;
  font-size: 18px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bar);
  backdrop-filter: blur(16px);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: 112px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bar);
  backdrop-filter: blur(16px);
}

.chat-header {
  justify-content: space-between;
}

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

.message-search {
  width: min(240px, 34vw);
  min-height: 38px;
}

.remote-search-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.toolbar-actions::-webkit-scrollbar {
  display: none;
}

.toolbar-actions select {
  flex: 1 1 82px;
  min-width: 76px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 650;
}

.toolbar-actions .icon-button {
  flex: 0 0 34px;
  width: 34px;
  min-height: 34px;
  font-size: 17px;
}

.topbar h1,
.chat-header h2 {
  font-size: 18px;
  line-height: 1.2;
}

.topbar h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(199, 199, 204, 0.72);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-size: 20px;
  backdrop-filter: blur(12px);
}

.dialog-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
}

.empty-note {
  padding: 20px 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.search-box input {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: #eef0f4;
}

.search-box button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
  border-radius: 12px;
}

.dialog-filters {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-filters button {
  min-height: 32px;
  flex: 1;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #eef0f4;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.dialog-filters button.active {
  background: var(--accent);
  color: #fff;
}

.dialog-button {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 5px 11px;
  width: 100%;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.dialog-button:hover,
.dialog-button.active {
  border-color: transparent;
  background: #eef4ff;
}

.dialog-skeleton {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 48px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 8px 11px;
  min-height: 74px;
  padding: 10px 12px;
}

.skeleton-avatar,
.skeleton-line {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
}

.skeleton-avatar::after,
.skeleton-line::after {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, #fff 40%, transparent), transparent);
  animation: skeleton-shimmer 1.25s ease-in-out infinite;
  content: "";
}

.skeleton-avatar {
  grid-row: 1 / 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
}

.skeleton-line {
  height: 13px;
  border-radius: 999px;
}

.skeleton-line.title {
  width: min(72%, 260px);
}

.skeleton-line.time {
  grid-column: 3;
  width: 42px;
  justify-self: end;
}

.skeleton-line.preview {
  width: min(88%, 340px);
}

.account-loading p {
  position: relative;
  padding-top: 34px;
}

.account-loading p::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border: 2px solid color-mix(in srgb, var(--muted) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  content: "";
}

@keyframes skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.dialog-title,
.dialog-preview,
.dialog-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-title {
  grid-column: 2 / 3;
  font-size: 15px;
  font-weight: 720;
}

.dialog-avatar {
  grid-row: 1 / 3;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, hsl(var(--avatar-hue, 205) 78% 58%), hsl(calc(var(--avatar-hue, 205) + 34) 78% 45%));
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.12);
}

.dialog-avatar img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.dialog-avatar.has-photo {
  overflow: hidden;
  color: transparent;
  background: #1c1c1e;
}

.dialog-button.muted .dialog-title {
  color: #4b5563;
}

.dialog-preview {
  grid-column: 2 / 3;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.dialog-date {
  grid-column: 3;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.dialog-pin {
  display: inline-grid;
  min-width: 32px;
  height: 18px;
  place-items: center;
  margin-right: 6px;
  border-radius: 999px;
  background: #e8f1ff;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 750;
  vertical-align: 1px;
}

.dialog-pin.archived {
  background: #f3f4f6;
  color: var(--muted);
}

.global-result .dialog-preview mark {
  border-radius: 4px;
  padding: 0 2px;
  background: #fff3a3;
  color: inherit;
}

.unread {
  grid-column: 3;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  padding: 0 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
}

.dialog-muted,
.muted-unread {
  grid-column: 3;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: #f3f4f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.conversation {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.pinned-message-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.pinned-message-bar span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.pinned-message-bar strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.message-list {
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  scroll-behavior: auto;
  scroll-padding-bottom: 92px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  background:
    radial-gradient(circle at 10% 12%, rgba(0, 122, 255, 0.035), transparent 26%),
    linear-gradient(180deg, #f5f6fa 0%, #ffffff 58%);
}

.date-divider {
  display: table;
  margin: 12px auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.16);
  color: #6b7280;
  font-size: 12px;
  font-weight: 720;
}

.load-more {
  display: block;
  width: fit-content;
  min-height: 34px;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.message-list.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.message {
  display: grid;
  justify-items: start;
  margin: 7px 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

.message.mine {
  justify-items: end;
}

.bubble {
  max-width: min(640px, 82%);
  border-radius: 18px;
  padding: 8px 10px 6px 12px;
  background: var(--theirs);
  color: var(--text);
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.sender-name {
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 760;
}

.reply-chip {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 5px 8px;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 3px solid rgba(0, 122, 255, 0.72);
  border-radius: 7px;
  background: rgba(0, 122, 255, 0.08);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 730;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.message.mine .reply-chip {
  border-left-color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.message-highlight .bubble {
  animation: messageFlash 1.8s ease;
}

@keyframes messageFlash {
  0%,
  100% {
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  }
  25%,
  70% {
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.8), 0 10px 26px rgba(17, 24, 39, 0.16);
  }
}

.message-text {
  vertical-align: baseline;
}

.bubble-time {
  display: inline-block;
  margin-left: 8px;
  color: rgba(107, 114, 128, 0.82);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  vertical-align: baseline;
}

.read-receipt {
  display: inline-block;
  min-width: 16px;
  margin-left: 4px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -1px;
}

.bubble mark {
  border-radius: 4px;
  padding: 0 2px;
  background: #fff3a3;
  color: inherit;
}

.media-preview {
  display: block;
  max-width: min(420px, 100%);
  max-height: 320px;
  margin-bottom: 8px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid rgba(16, 32, 29, 0.08);
  cursor: zoom-in;
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.web-preview {
  display: grid;
  gap: 3px;
  margin: 2px 0 8px;
  padding: 8px 10px;
  border-left: 3px solid rgba(0, 122, 255, 0.65);
  border-radius: 8px;
  background: rgba(0, 122, 255, 0.08);
  color: inherit;
  text-decoration: none;
}

.web-preview strong,
.web-preview span,
.web-preview small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.web-preview strong {
  font-size: 13px;
  font-weight: 780;
}

.web-preview span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.web-preview small {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 720;
}

.message.mine .web-preview {
  border-left-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.14);
}

.message.mine .web-preview span,
.message.mine .web-preview small {
  color: rgba(255, 255, 255, 0.8);
}

.mini-app-buttons {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.mini-app-button-row {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 6px;
}

.mini-app-button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 760;
}

.message.mine .mini-app-button {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.message-reactions span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 760;
}

.message-reactions span.chosen,
.message.mine .message-reactions span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.message.mine .bubble {
  background: var(--mine);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.message.mine .bubble-time {
  color: rgba(255, 255, 255, 0.78);
}

.message:not(.mine) .bubble {
  border-bottom-left-radius: 5px;
  border: 1px solid rgba(216, 216, 223, 0.75);
}

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  position: relative;
  z-index: 3;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bar);
  backdrop-filter: blur(16px);
}

.composer-context {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 30px;
  align-items: center;
  gap: 8px;
  margin-bottom: -2px;
  padding: 8px 9px 8px 11px;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(0, 122, 255, 0.08);
}

.upload-progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 3px 4px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.upload-progress progress {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.22);
}

.upload-progress progress::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.22);
}

.upload-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.upload-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.composer-context div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.composer-context strong,
.composer-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-context strong {
  color: var(--accent-dark);
  font-size: 12px;
}

.composer-context span {
  color: var(--muted);
  font-size: 12px;
}

.composer-context .icon-button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 20px;
}

.composer button {
  min-width: 44px;
}

.composer .icon-button {
  min-width: 44px;
}

.composer textarea {
  border: 1px solid #d1d1d6;
  border-radius: 20px;
  min-height: 42px;
  padding: 10px 13px;
  background: #fff;
  font-size: 16px;
  line-height: 1.32;
}

.send-button {
  display: grid;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  font-size: 18px;
  background: var(--accent);
}

.jump-bottom {
  position: absolute;
  right: 14px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 4;
  display: grid;
  width: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(199, 199, 204, 0.74);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.16);
  backdrop-filter: blur(14px);
  font-size: 20px;
}

.jump-bottom.has-news {
  width: auto;
  min-width: 112px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 760;
}

.file-input {
  display: none;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button.active {
  border-color: rgba(0, 122, 255, 0.3);
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent-dark);
}

.danger-button {
  border: 1px solid #f3b8b2;
  background: #fff4f2;
  color: var(--danger);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 32, 29, 0.28);
}

.modal-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-panel h2 {
  font-size: 18px;
}

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

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

.modal-subtitle {
  margin-top: -6px;
  color: var(--muted);
  font-size: 13px;
}

.read-participants-panel {
  max-height: min(620px, 84dvh);
}

.read-participants-list {
  display: grid;
  gap: 8px;
  min-height: 80px;
  max-height: min(430px, 54dvh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.read-participant-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  min-height: 52px;
  padding: 6px 2px;
}

.read-participant-row .dialog-avatar {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
}

.read-participant-row strong,
.read-participant-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.read-participant-row strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 720;
}

.read-participant-row span {
  color: var(--muted);
  font-size: 13px;
}

.danger-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 4px;
}

.status-panel {
  gap: 16px;
}

.new-chat-result {
  display: grid;
  gap: 8px;
  min-height: 0;
  max-height: min(430px, 48dvh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.forward-targets {
  display: grid;
  gap: 8px;
  max-height: min(430px, 48dvh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.forward-targets .dialog-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.reaction-sheet {
  gap: 10px;
}

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

.reaction-grid button {
  min-height: 52px;
  padding: 0 8px;
  font-size: 22px;
}

.reaction-grid button:last-child {
  grid-column: span 2;
  color: var(--danger);
  font-size: 15px;
}

.new-chat-result .dialog-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.update-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.status-grid {
  display: grid;
  gap: 8px;
}

.users-panel {
  width: min(520px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
}

.telegram-devices-panel {
  width: min(620px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: auto;
}

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

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

.telegram-device-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.telegram-device-row strong,
.telegram-device-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-device-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.telegram-device-row button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.current-user {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f2f2f7;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

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

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

.section-heading h3 {
  margin: 0;
  font-size: 15px;
}

.section-heading button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

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

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

.session-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.session-row strong,
.session-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.session-row button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.compact-form {
  gap: 10px;
  margin-top: 0;
}

.admin-users {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.admin-users h3 {
  margin: 0;
  font-size: 15px;
}

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

.audit-list {
  display: grid;
  gap: 7px;
  max-height: 180px;
  overflow: auto;
}

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

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

.user-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.user-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.user-row strong,
.user-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.audit-row {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.audit-row strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.audit-row span {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.status-item {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  font-size: 13px;
  line-height: 1.35;
}

.status-label {
  color: var(--muted);
  font-weight: 700;
}

.status-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mobile-only {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 14, 12, 0.86);
}

.image-modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.image-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 21;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
}

.image-nav {
  position: fixed;
  top: 50%;
  z-index: 21;
  width: 48px;
  min-height: 48px;
  transform: translateY(-50%);
  border-color: rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 34px;
}

.image-nav:disabled {
  display: none;
}

.image-prev {
  left: 14px;
}

.image-next {
  right: 14px;
}

.image-counter {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 21;
  transform: translateX(-50%);
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 760;
}

.mini-app-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
}

.mini-app-header {
  display: grid;
  grid-template-columns: 42px 1fr 42px 42px;
  align-items: center;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bar);
  backdrop-filter: blur(18px);
}

.mini-app-header .icon-button {
  width: 38px;
  min-height: 38px;
  border-radius: 50%;
}

.mini-app-header div {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: center;
}

.mini-app-header strong,
.mini-app-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-app-header strong {
  font-size: 15px;
  font-weight: 780;
}

.mini-app-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.mini-app-modal iframe {
  grid-row: 2;
  grid-column: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.mini-app-fallback {
  grid-row: 2;
  grid-column: 1;
  z-index: 2;
  align-self: start;
  justify-self: center;
  display: grid;
  width: min(360px, calc(100% - 32px));
  gap: 7px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  text-align: center;
}

.mini-app-fallback strong {
  font-size: 14px;
}

.mini-app-fallback span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.mini-app-fallback button {
  min-height: 38px;
  border-radius: 10px;
  font-size: 14px;
}

.action-sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  padding: 12px 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.18);
}

.action-sheet {
  display: grid;
  gap: 8px;
}

.action-sheet-info {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(60, 60, 67, 0.12);
  backdrop-filter: blur(18px);
}

.action-sheet-info strong,
.action-sheet-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-sheet-info strong {
  font-size: 15px;
  font-weight: 720;
}

.action-sheet-info span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
}

.action-sheet button {
  min-height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent);
  box-shadow: 0 1px 0 rgba(60, 60, 67, 0.12);
  backdrop-filter: blur(18px);
  font-size: 17px;
  font-weight: 650;
}

.action-sheet button:disabled {
  color: var(--muted);
  opacity: 0.42;
}

.action-sheet .action-cancel {
  margin-top: 2px;
  color: #111827;
  font-weight: 760;
}

@media (max-width: 760px) {
  body {
    overscroll-behavior: none;
    background: var(--surface);
  }

  .chat-view {
    grid-template-columns: 1fr;
    height: var(--app-height);
    max-height: var(--app-height);
    background: var(--surface);
  }

  .sidebar,
  .conversation {
    grid-column: 1;
    grid-row: 1;
  }

  .conversation {
    transform: translateX(100%);
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    background: #fff;
    box-shadow: -18px 0 38px rgba(17, 24, 39, 0.12);
  }

  .chat-view.conversation-open .conversation {
    transform: translateX(0);
  }

  .chat-view.conversation-open .sidebar {
    visibility: hidden;
  }

  .mobile-only {
    display: grid;
  }

  .message-list {
    padding: 12px 10px 14px;
    scroll-padding-bottom: 116px;
    -webkit-overflow-scrolling: touch;
  }

  .conversation.keyboard-open .message-list {
    scroll-padding-bottom: 148px;
  }

  .bubble {
    max-width: 80%;
    font-size: 15px;
    line-height: 1.36;
  }

  .chat-header {
    position: relative;
    top: auto;
    z-index: 2;
    min-height: 58px;
    align-items: center;
    flex-wrap: nowrap;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    border-bottom-color: rgba(216, 216, 223, 0.72);
    background: rgba(249, 249, 251, 0.86);
    backdrop-filter: blur(18px);
  }

  .chat-header h2 {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-header p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .message-search {
    display: none;
    position: absolute;
    left: 10px;
    right: 96px;
    bottom: -46px;
    width: auto;
    min-height: 40px;
    z-index: 3;
  }

  .remote-search-button {
    display: none;
    position: absolute;
    right: 10px;
    bottom: -46px;
    min-width: 82px;
    z-index: 3;
  }

  .chat-view.search-open .chat-header {
    margin-bottom: 48px;
  }

  .chat-view.search-open .message-search,
  .chat-view.search-open .remote-search-button {
    display: block;
  }

  .toolbar-actions {
    gap: 6px;
  }

  .topbar {
    position: relative;
    top: auto;
    z-index: 2;
    min-height: 122px;
    padding: calc(12px + env(safe-area-inset-top)) 12px 10px;
    background: rgba(249, 249, 251, 0.9);
  }

  .topbar h1 {
    font-size: 31px;
  }

  .topbar p {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-box {
    position: relative;
    top: auto;
    z-index: 1;
    padding: 8px 10px;
    background: rgba(249, 249, 251, 0.94);
    backdrop-filter: blur(18px);
  }

  .status-item {
    grid-template-columns: 92px 1fr;
  }

  .icon-button {
    width: 38px;
    min-height: 38px;
  }

  .dialog-list {
    padding: 0 0 10px;
  }

  .dialog-button {
    min-height: 74px;
    padding: 9px 12px;
    border-radius: 0;
    border-color: transparent;
    border-bottom-color: var(--line);
  }

  .dialog-button:hover,
  .dialog-button.active {
    border-color: transparent;
    border-bottom-color: var(--line);
    background: #edf5ff;
  }

  .dialog-title {
    font-size: 15px;
  }

  .dialog-preview {
    font-size: 13px;
  }

  .composer {
    gap: 7px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top-color: rgba(216, 216, 223, 0.7);
    transform: translateZ(0);
  }

  .composer .icon-button,
  .composer .send-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }

  .composer textarea {
    min-height: 42px;
    max-height: 104px;
  }
}

@media (max-width: 760px) {
  :root {
    --bg: #f2f2f7;
    --surface: #f9f9fb;
    --line: rgba(60, 60, 67, 0.18);
    --text: #111827;
    --muted: #7b8494;
  }

  .app-shell,
  .chat-view,
  .sidebar,
  .conversation {
    height: 100dvh;
    height: var(--app-height);
    max-height: var(--app-height);
  }

  .sidebar {
    grid-template-rows: auto auto auto auto 1fr;
    border-right: 0;
    background: #f2f2f7;
  }

  .app-notice {
    margin: 8px 10px 0;
    border: 0;
    border-radius: 13px;
    background: #fff4df;
    box-shadow: 0 1px 0 rgba(60, 60, 67, 0.08);
  }

  .topbar {
    min-height: auto;
    padding: calc(10px + env(safe-area-inset-top)) 12px 8px;
    border-bottom: 0;
    background: rgba(242, 242, 247, 0.92);
  }

  .topbar > div:first-child {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 8px;
  }

  .topbar h1 {
    font-size: 34px;
    line-height: 1.05;
    font-weight: 820;
  }

  .topbar p {
    justify-self: end;
    max-width: 138px;
    margin-bottom: 2px;
    color: #34c759;
    font-size: 12px;
    font-weight: 720;
    text-align: right;
  }

  .toolbar-actions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .toolbar-actions::-webkit-scrollbar {
    display: none;
  }

  .toolbar-actions select {
    width: auto;
    min-width: 118px;
    height: 36px;
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(60, 60, 67, 0.12);
    color: var(--accent);
    font-size: 14px;
  }

  .toolbar-actions .icon-button {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    min-height: 36px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 0 rgba(60, 60, 67, 0.12);
    color: var(--accent);
    font-size: 19px;
  }

  .toolbar-actions #addAccount,
  .toolbar-actions #manageAccount,
  .toolbar-actions #notifyButton,
  .toolbar-actions #statusButton,
  .toolbar-actions #usersButton,
  .toolbar-actions #lockButton {
    display: none;
  }

  .toolbar-actions #refreshDialogs,
  .toolbar-actions #mobileMoreActions {
    display: grid;
  }

  .search-box {
    top: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 0;
    background: rgba(242, 242, 247, 0.94);
  }

  .search-box input {
    min-height: 38px;
    border-radius: 11px;
    background: #e5e5ea;
    color: #111827;
    font-size: 16px;
  }

  .search-box input::placeholder {
    color: #8e8e93;
  }

  .search-box button {
    min-width: 70px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--accent);
    font-size: 15px;
    font-weight: 720;
  }

  .dialog-filters {
    gap: 0;
    margin: 0 12px 8px;
    padding: 2px;
    border: 0;
    border-radius: 10px;
    background: #e5e5ea;
  }

  .dialog-filters button {
    min-height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #4b5563;
    font-size: 13px;
    transition: background 160ms ease, color 160ms ease;
  }

  .dialog-filters button.active {
    background: #fff;
    color: #111827;
    box-shadow: 0 1px 3px rgba(60, 60, 67, 0.18);
  }

  .dialog-list {
    margin: 0 10px 10px;
    padding: 0;
    border-radius: 18px;
    background: #fff;
    overflow: auto;
  }

  .dialog-button {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    min-height: 76px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.13);
    background: #fff;
  }

  .dialog-button:last-child {
    border-bottom: 0;
  }

  .dialog-button:hover,
  .dialog-button.active {
    background: #f1f7ff;
    border-bottom-color: rgba(60, 60, 67, 0.13);
  }

  .dialog-avatar {
    width: 50px;
    height: 50px;
    font-size: 19px;
  }

  .dialog-title {
    font-size: 16px;
    font-weight: 760;
  }

  .dialog-preview {
    grid-column: 2 / -1;
    font-size: 14px;
    color: #7b8494;
  }

  .dialog-date {
    align-self: start;
    padding-top: 2px;
    font-size: 12px;
  }

  .unread,
  .dialog-muted,
  .muted-unread {
    align-self: start;
    margin-top: 1px;
  }

  .conversation {
    grid-template-rows: auto 1fr auto;
    background: #f2f2f7;
    box-shadow: -16px 0 42px rgba(17, 24, 39, 0.18);
  }

  .chat-header {
    min-height: 60px;
    padding: calc(7px + env(safe-area-inset-top)) 10px 7px;
    border-bottom: 1px solid rgba(60, 60, 67, 0.16);
    background: rgba(249, 249, 251, 0.88);
  }

  #backToDialogs {
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 34px;
    box-shadow: none;
  }

  #toggleMessageSearch {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--accent);
    box-shadow: 0 1px 0 rgba(60, 60, 67, 0.12);
  }

  .chat-header h2 {
    font-size: 17px;
    font-weight: 780;
    text-align: center;
  }

  .chat-header p {
    margin-top: 2px;
    color: #8e8e93;
    font-size: 12px;
    text-align: center;
  }

  .message-search {
    left: 12px;
    right: 98px;
    bottom: -48px;
    border: 0;
    border-radius: 12px;
    background: #e5e5ea;
  }

  .remote-search-button {
    right: 12px;
    bottom: -48px;
    border: 0;
    color: var(--accent);
  }

  .message-list {
    padding: 12px 10px 14px;
    background:
      radial-gradient(circle at 18% 18%, rgba(0, 122, 255, 0.05), transparent 28%),
      linear-gradient(180deg, #f7f7fb 0%, #fff 72%);
  }

  .date-divider {
    background: rgba(142, 142, 147, 0.18);
    color: #6b7280;
  }

  .bubble {
    max-width: 82%;
    border-radius: 19px;
    padding: 8px 10px 6px 12px;
    font-size: 16px;
    line-height: 1.34;
  }

  .message:not(.mine) .bubble {
    border: 0;
    background: #fff;
  }

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

  .composer {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(60, 60, 67, 0.16);
    background: rgba(249, 249, 251, 0.9);
  }

  .composer textarea {
    min-height: 42px;
    border: 1px solid #d1d1d6;
    border-radius: 21px;
    font-size: 16px;
  }

  .composer .icon-button,
  .composer .send-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    border: 0;
    box-shadow: none;
  }

  .composer .icon-button {
    background: transparent;
    color: var(--accent);
    font-size: 27px;
  }

  .composer .send-button {
    background: var(--accent);
    color: #fff;
    font-size: 18px;
  }
}

body.theme-dark-active .topbar,
body.theme-dark-active .search-box,
body.theme-dark-active .chat-header,
body.theme-dark-active .composer {
  background: var(--bar);
}

body.theme-dark-active .sidebar {
  background: var(--bg);
}

body.theme-dark-active .dialog-list {
  background: var(--list-surface);
}

body.theme-dark-active .dialog-button {
  border-bottom-color: var(--line);
  background: var(--list-surface);
}

body.theme-dark-active .dialog-button:hover,
body.theme-dark-active .dialog-button.active {
  background: #142a44;
  border-bottom-color: var(--line);
}

body.theme-dark-active .search-box input,
body.theme-dark-active .message-search {
  background: var(--field-muted);
  color: var(--text);
}

body.theme-dark-active .dialog-filters {
  background: #202832;
}

body.theme-dark-active .dialog-filters button.active {
  background: #2c3744;
  color: var(--text);
}

body.theme-dark-active #toggleMessageSearch,
body.theme-dark-active .toolbar-actions select,
body.theme-dark-active .toolbar-actions .icon-button {
  background: #202832;
  color: #7cc0ff;
}

body.theme-dark-active .message-list {
  background:
    radial-gradient(circle at 18% 18%, rgba(10, 132, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #0d1218 0%, #11161d 74%);
}

body.theme-dark-active .message:not(.mine) .bubble {
  background: var(--theirs);
}

body.theme-dark-active .composer .icon-button {
  background: transparent;
  color: #7cc0ff;
}

body.theme-dark-active .modal-layer {
  background: rgba(0, 0, 0, 0.52);
}

/* Telegram iOS dark visual layer */
body.theme-dark-active {
  --bg: #000000;
  --surface: #000000;
  --bar: rgba(28, 28, 30, 0.72);
  --line: rgba(84, 84, 88, 0.36);
  --line-strong: rgba(99, 99, 102, 0.48);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --accent: #408cff;
  --accent-dark: #5e9bff;
  --mine: #2f83ff;
  --theirs: #1c1c1e;
  --field: rgba(118, 118, 128, 0.24);
  --field-muted: rgba(118, 118, 128, 0.24);
  --list-surface: #000000;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.42);
}

body.theme-dark-active .chat-view,
body.theme-dark-active .sidebar,
body.theme-dark-active .conversation {
  background: #000;
}

body.theme-dark-active .topbar,
body.theme-dark-active .chat-header,
body.theme-dark-active .search-box,
body.theme-dark-active .dialog-filters,
body.theme-dark-active .composer,
body.theme-dark-active .mobile-tabbar,
body.theme-dark-active .pinned-message-bar {
  -webkit-backdrop-filter: saturate(180%) blur(26px);
  backdrop-filter: saturate(180%) blur(26px);
}

body.theme-dark-active .dialog-list,
body.theme-dark-active .dialog-button {
  background: #000;
}

body.theme-dark-active .dialog-button {
  border-radius: 0;
  border-bottom: 1px solid rgba(84, 84, 88, 0.28);
}

body.theme-dark-active .dialog-button:hover,
body.theme-dark-active .dialog-button.active {
  background: rgba(44, 44, 46, 0.72);
}

body.theme-dark-active .dialog-title {
  color: #f5f5f7;
  font-weight: 780;
}

body.theme-dark-active .dialog-button.muted .dialog-title {
  color: rgba(245, 245, 247, 0.58);
}

body.theme-dark-active .dialog-button.muted .dialog-preview,
body.theme-dark-active .dialog-button.muted .dialog-date {
  color: rgba(142, 142, 147, 0.64);
}

body.theme-dark-active .dialog-button.muted .dialog-avatar {
  opacity: 0.62;
}

.dialog-title-muted {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  background: var(--muted);
  vertical-align: -1px;
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}

body.theme-dark-active .dialog-preview,
body.theme-dark-active .dialog-date {
  color: #8e8e93;
}

body.theme-dark-active .unread {
  background: #0a84ff;
  color: #fff;
}

body.theme-dark-active .dialog-muted {
  background: rgba(142, 142, 147, 0.18);
  color: rgba(235, 235, 245, 0.52);
}

body.theme-dark-active .muted-unread {
  border: 1px solid rgba(142, 142, 147, 0.38);
  background: rgba(142, 142, 147, 0.16);
  color: rgba(235, 235, 245, 0.48);
}

body.theme-dark-active .dialog-pin,
body.theme-dark-active .dialog-pin.archived {
  background: transparent;
  color: #8e8e93;
  min-width: 0;
  height: auto;
  margin-right: 5px;
  font-size: 0;
}

body.theme-dark-active .dialog-pin::before,
body.theme-dark-active .dialog-pin.archived::before {
  content: "置顶";
  font-size: 11px;
}

body.theme-dark-active .message-list {
  background: #050505;
}

body.theme-dark-active .message:not(.mine) .bubble {
  background: #1c1c1e;
  color: #f5f5f7;
}

body.theme-dark-active .message.mine .bubble {
  background: #2f83ff;
}

.mobile-tabbar {
  display: none;
}

.settings-page {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-profile {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 18px 18px 22px;
}

.settings-avatar {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #6ec6ff, #2f83ff);
  color: #fff;
  font-size: 44px;
  font-weight: 820;
}

.settings-profile strong {
  color: var(--text);
  font-size: 28px;
  font-weight: 820;
}

.settings-profile small {
  color: var(--muted);
  font-size: 15px;
}

.settings-group {
  display: grid;
  margin: 0 18px 18px;
  overflow: hidden;
  border-radius: 24px;
  background: color-mix(in srgb, var(--theirs) 88%, transparent);
}

.settings-group button {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 14px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.settings-group button:last-child {
  border-bottom: 0;
}

.settings-group button.settings-account-row {
  grid-template-columns: 46px minmax(0, 1fr) auto;
}

.settings-account-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.settings-group strong,
.settings-group small,
.settings-account-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-group strong {
  font-size: 18px;
  font-weight: 720;
}

.settings-group small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 620;
}

.settings-group em {
  color: var(--muted);
  font-style: normal;
  font-size: 24px;
  font-weight: 520;
}

.settings-icon,
.settings-account-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
}

.settings-account-avatar {
  border-radius: 50%;
  background: linear-gradient(145deg, #5ac8fa, #007aff);
}

.settings-icon.blue { background: #0a84ff; }
.settings-icon.green { background: #30d158; }
.settings-icon.orange { background: #ff9f0a; }
.settings-icon.red { background: #ff453a; }
.settings-icon.purple { background: #bf5af2; }
.settings-icon.cyan { background: #64d2ff; }
.settings-icon.gray { background: #8e8e93; }

.tab-glyph,
.glyph-button::before,
.settings-icon::before {
  display: block;
  width: 25px;
  height: 25px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}

.settings-icon::before {
  width: 20px;
  height: 20px;
  color: #fff;
  background: #fff;
}

.glyph-button {
  font-size: 0 !important;
}

.icon-profile { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M12 12.2a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Zm0 2.1c-4.3 0-7.9 2.3-8.6 5.5-.2.8.4 1.5 1.2 1.5h14.8c.8 0 1.4-.7 1.2-1.5-.7-3.2-4.3-5.5-8.6-5.5Z'/%3E%3C/svg%3E"); }
.icon-phone { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M7.2 2.8c.6-.3 1.3-.1 1.7.4l2 3.1c.3.5.3 1.2-.1 1.7l-1.3 1.5c.9 1.8 2.4 3.3 4.2 4.2l1.5-1.3c.5-.4 1.2-.5 1.7-.1l3.1 2c.6.4.8 1.1.4 1.7l-1.2 2.5c-.4.8-1.2 1.3-2.1 1.3C10 19.8 4.2 14 4.2 6.9c0-.9.5-1.7 1.3-2.1l1.7-2Z'/%3E%3C/svg%3E"); }
.icon-chat { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 28 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M10.8 3.2c-4.9 0-8.8 2.9-8.8 6.7 0 2 1.1 3.8 2.8 5l-.7 2.5c-.2.8.7 1.4 1.4.9l2.9-1.9c.8.2 1.6.3 2.4.3 4.9 0 8.8-2.9 8.8-6.8 0-3.8-3.9-6.7-8.8-6.7Zm5.7 14.1c1.5-.7 2.8-1.8 3.6-3.1 2.7.6 4.9 2.4 4.9 4.8 0 1.5-.8 2.8-2.2 3.7l.5 1.8c.2.7-.6 1.3-1.2.8l-2.2-1.4c-.6.2-1.2.2-1.9.2-3.4 0-6.2-1.8-6.9-4.2 2-.1 3.8-.5 5.4-1.3Z'/%3E%3C/svg%3E"); }
.icon-gear { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' fill-rule='evenodd' d='M10.7 2h2.6l.7 2.2c.5.2 1 .4 1.5.6l2.1-1.1 1.8 1.8-1.1 2.1c.3.5.5 1 .6 1.5l2.1.7v2.6l-2.1.7c-.2.5-.4 1-.6 1.5l1.1 2.1-1.8 1.8-2.1-1.1c-.5.3-1 .5-1.5.6l-.7 2.1h-2.6l-.7-2.1c-.5-.2-1-.4-1.5-.6l-2.1 1.1-1.8-1.8 1.1-2.1c-.3-.5-.5-1-.6-1.5L3 12.4V9.8l2.2-.7c.2-.5.4-1 .6-1.5L4.7 5.5l1.8-1.8 2.1 1.1c.5-.3 1-.5 1.5-.6l.6-2.2ZM12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z'/%3E%3C/svg%3E"); }
.icon-search { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M10.5 4a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-8.5 6.5a8.5 8.5 0 1 1 15.1 5.4l4.2 4.2-1.4 1.4-4.2-4.2A8.5 8.5 0 0 1 2 10.5Z'/%3E%3C/svg%3E"); }
.icon-compose { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M16.9 3.4a2 2 0 0 1 2.8 2.8l-8.6 8.6-3.6.8.8-3.6 8.6-8.6ZM5 5.5h7.2l-2 2H6.7c-.7 0-1.2.5-1.2 1.2v8.6c0 .7.5 1.2 1.2 1.2h8.6c.7 0 1.2-.5 1.2-1.2v-3.5l2-2v5.5c0 1.8-1.4 3.2-3.2 3.2H6.7a3.2 3.2 0 0 1-3.2-3.2V8.7C3.5 6.9 4.9 5.5 6.7 5.5Z'/%3E%3C/svg%3E"); }
.icon-device { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M4 5.5C4 4.7 4.7 4 5.5 4h13c.8 0 1.5.7 1.5 1.5v9c0 .8-.7 1.5-1.5 1.5h-13c-.8 0-1.5-.7-1.5-1.5v-9Zm6.5 12H7.8c-.5 0-.8.3-.8.8s.3.8.8.8h8.4c.5 0 .8-.3.8-.8s-.3-.8-.8-.8h-2.7V16h-3v1.5Z'/%3E%3C/svg%3E"); }
.icon-lock { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M7 10V8a5 5 0 0 1 10 0v2h.5c.8 0 1.5.7 1.5 1.5v7c0 .8-.7 1.5-1.5 1.5h-11c-.8 0-1.5-.7-1.5-1.5v-7c0-.8.7-1.5 1.5-1.5H7Zm2 0h6V8a3 3 0 1 0-6 0v2Z'/%3E%3C/svg%3E"); }
.icon-bell { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M12 3a5.5 5.5 0 0 0-5.5 5.5v2.8c0 1-.4 2-1.1 2.7l-.7.7c-.6.6-.2 1.6.7 1.6h13.2c.9 0 1.3-1 .7-1.6l-.7-.7c-.7-.7-1.1-1.7-1.1-2.7V8.5A5.5 5.5 0 0 0 12 3Zm-2.2 14.6a2.3 2.3 0 0 0 4.4 0H9.8Z'/%3E%3C/svg%3E"); }
.icon-moon { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M20.2 14.7A8.7 8.7 0 0 1 9.3 3.8c.3-.8-.5-1.5-1.2-1A10.4 10.4 0 1 0 21.2 15.9c.5-.7-.2-1.5-1-1.2Z'/%3E%3C/svg%3E"); }
.icon-info { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M12 2.8a9.2 9.2 0 1 0 0 18.4 9.2 9.2 0 0 0 0-18.4Zm1 13.7h-2v-6h2v6Zm0-8h-2v-2h2v2Z'/%3E%3C/svg%3E"); }
.icon-plus { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6V5Z'/%3E%3C/svg%3E"); }
.icon-shield { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M12 2.5 4.5 5.3v5.6c0 4.7 3 8.9 7.5 10.6 4.5-1.7 7.5-5.9 7.5-10.6V5.3L12 2.5Z'/%3E%3C/svg%3E"); }
.icon-muted { --glyph: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M4 9h3.2L12 5.2c.7-.6 1.8-.1 1.8.8v3.1l-2 2V8.6L8.2 11.5H6v1h1.2l-2 2H4V9Zm13.7-3.3 1.4 1.4L6.3 19.9l-1.4-1.4L17.7 5.7Zm-3.9 9.2 2.3-2.3c.2-.9.2-1.8 0-2.6-.2-.7.2-1.3.9-1.5.7-.2 1.3.2 1.5.9.5 1.7.4 3.6-.3 5.2l1.7 1.7-1.4 1.4-4.7-4.7v1.9c0 .9-1.1 1.4-1.8.8l-1.7-1.4 1.4-1.4 2.1 1.7v.3Z'/%3E%3C/svg%3E"); }

@media (max-width: 760px) {
  body.theme-dark-active {
    background: #000;
  }

  body.theme-dark-active .chat-view {
    background: #000;
  }

  body.theme-dark-active .sidebar {
    grid-template-rows: auto auto auto 1fr auto;
    background: #000;
  }

  body.theme-dark-active .topbar {
    display: grid;
    grid-template-columns: 82px 1fr 118px;
    align-items: center;
    min-height: 94px;
    padding: calc(28px + env(safe-area-inset-top)) 28px 8px;
    border-bottom: 0;
    background: rgba(0, 0, 0, 0.44);
  }

  body.theme-dark-active .topbar > div:first-child {
    display: contents;
  }

  body.theme-dark-active .topbar h1 {
    grid-column: 2;
    justify-self: center;
    display: inline-grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    line-height: 1;
    font-weight: 820;
    letter-spacing: 0;
  }

  body.theme-dark-active .topbar h1::before {
    content: attr(data-initial);
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 2px solid rgba(52, 199, 89, 0.86);
    border-radius: 50%;
    background: linear-gradient(145deg, #64d2ff, #2f83ff);
    color: #fff;
    font-size: 15px;
    font-weight: 820;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.35);
  }

  body.theme-dark-active .topbar h1[data-section="settings"]::before {
    display: none;
  }

  body.theme-dark-active .topbar p {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    max-width: none;
    min-height: 48px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(28, 28, 30, 0.68);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.2);
  }

  body.theme-dark-active .topbar p::before {
    content: "编辑";
    font-size: 17px;
    font-weight: 720;
  }

  body.theme-dark-active .toolbar-actions {
    grid-column: 3;
    justify-self: end;
    display: grid;
    grid-template-columns: 48px 48px;
    gap: 0;
    width: 104px;
    min-height: 48px;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(28, 28, 30, 0.68);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.18);
    overflow: visible;
  }

  body.theme-dark-active .toolbar-actions select,
  body.theme-dark-active .toolbar-actions #addAccount,
  body.theme-dark-active .toolbar-actions #manageAccount,
  body.theme-dark-active .toolbar-actions #notifyButton,
  body.theme-dark-active .toolbar-actions #statusButton,
  body.theme-dark-active .toolbar-actions #usersButton,
  body.theme-dark-active .toolbar-actions #lockButton,
  body.theme-dark-active .toolbar-actions #refreshDialogs {
    display: none;
  }

  body.theme-dark-active .toolbar-actions #newChatButton,
  body.theme-dark-active .toolbar-actions #mobileMoreActions {
    display: grid;
    width: 48px;
    height: 46px;
    min-height: 46px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    box-shadow: none;
  }

  body.theme-dark-active .toolbar-actions #mobileMoreActions {
    order: 1;
  }

  body.theme-dark-active .toolbar-actions #newChatButton {
    order: 2;
  }

  body.theme-dark-active .toolbar-actions #mobileMoreActions {
    display: grid;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px 0 0 999px;
  }

  body.theme-dark-active .search-box {
    position: relative;
    z-index: 3;
    grid-template-columns: 1fr;
    display: none;
    margin: 0 36px 8px;
    padding: 0;
    background: transparent;
  }

  body.theme-dark-active .chat-view.list-search-open .search-box {
    display: grid;
  }

  body.theme-dark-active .search-box input {
    height: 42px;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(44, 44, 46, 0.72);
    color: #fff;
    font-size: 16px;
    text-align: center;
  }

  body.theme-dark-active .search-box input::placeholder {
    color: rgba(235, 235, 245, 0.5);
  }

  body.theme-dark-active .search-box button {
    display: none;
  }

  body.theme-dark-active .dialog-filters {
    position: relative;
    z-index: 3;
    gap: 0;
    margin: 0 36px 6px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(44, 44, 46, 0.68);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  body.theme-dark-active .dialog-filters button {
    height: 36px;
    min-height: 36px;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-size: 16px;
    font-weight: 760;
  }

  body.theme-dark-active .dialog-filters button.active {
    background: rgba(118, 118, 128, 0.46);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  body.theme-dark-active .dialog-list {
    margin: 0;
    padding: 0 0 calc(104px + env(safe-area-inset-bottom));
    border-radius: 0;
    background: #000;
  }

  body.theme-dark-active .settings-page {
    padding: 0 0 calc(104px + env(safe-area-inset-bottom));
    background: #000;
  }

  body.theme-dark-active .settings-profile {
    padding-top: 22px;
  }

  body.theme-dark-active .settings-avatar {
    width: 112px;
    height: 112px;
    font-size: 46px;
  }

  body.theme-dark-active .settings-profile strong {
    color: #fff;
    font-size: 30px;
  }

  body.theme-dark-active .settings-group {
    margin: 0 18px 20px;
    border-radius: 24px;
    background: #1c1c1e;
  }

  body.theme-dark-active .settings-group button {
    min-height: 62px;
    border-bottom-color: rgba(84, 84, 88, 0.34);
  }

  body.theme-dark-active .settings-group button.active {
    background: rgba(72, 72, 74, 0.54);
  }

  body.theme-dark-active .settings-group strong {
    color: #fff;
  }

  body.theme-dark-active .dialog-button {
    grid-template-columns: 68px minmax(0, 1fr) minmax(38px, max-content);
    grid-template-rows: 24px 21px 21px;
    min-height: 80px;
    padding: 7px 18px 7px 22px;
    gap: 0 9px;
    border: 0;
    border-bottom: 1px solid rgba(84, 84, 88, 0.34);
    background: #000;
  }

  body.theme-dark-active .dialog-avatar {
    grid-row: 1 / 4;
    width: 56px;
    height: 56px;
    font-size: 23px;
    box-shadow: none;
  }

  body.theme-dark-active .dialog-title {
    grid-column: 2 / 3;
    grid-row: 1;
    align-self: end;
    font-size: 17px;
    line-height: 1.1;
    font-weight: 760;
  }

  body.theme-dark-active .dialog-preview {
    grid-column: 2 / 3;
    grid-row: 2 / 4;
    align-self: start;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    color: #8e8e93;
    font-size: 15px;
    line-height: 1.22;
  }

  body.theme-dark-active .dialog-date {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    color: #8e8e93;
    font-size: 15px;
    line-height: 1;
  }

  body.theme-dark-active .unread,
  body.theme-dark-active .dialog-muted,
  body.theme-dark-active .muted-unread {
    grid-column: 3;
    grid-row: 2 / 4;
    align-self: center;
    justify-self: end;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    border: 0;
    border-radius: 999px;
    background: #0a84ff;
    color: #fff;
    font-size: 14px;
    font-weight: 780;
  }

  body.theme-dark-active .dialog-button.muted .unread,
  body.theme-dark-active .dialog-muted,
  body.theme-dark-active .muted-unread {
    background: rgba(142, 142, 147, 0.14);
    color: rgba(235, 235, 245, 0.46);
  }

  body.theme-dark-active .dialog-button.muted .muted-unread {
    border: 1px solid rgba(142, 142, 147, 0.34);
    background: rgba(142, 142, 147, 0.14);
    color: rgba(235, 235, 245, 0.46);
  }

  body.theme-dark-active .mobile-tabbar {
    position: fixed;
    left: 34px;
    right: 34px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 18;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) 64px;
    align-items: center;
    min-height: 70px;
    padding: 5px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.theme-dark-active .mobile-tabbar::before,
  body.theme-dark-active .mobile-tabbar .search-tab {
    -webkit-backdrop-filter: saturate(180%) blur(26px);
    backdrop-filter: saturate(180%) blur(26px);
  }

  body.theme-dark-active .mobile-tabbar::before {
    content: "";
    position: absolute;
    inset: 0 72px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(28, 28, 30, 0.66);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 34px rgba(0, 0, 0, 0.42);
  }

  body.theme-dark-active .mobile-tabbar button {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    gap: 1px;
    height: 60px;
    min-height: 60px;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    color: #fff;
  }

  body.theme-dark-active .mobile-tabbar button.active {
    background: rgba(118, 118, 128, 0.34);
    color: #408cff;
  }

  body.theme-dark-active .mobile-tabbar button.search-tab {
    margin-left: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background: rgba(28, 28, 30, 0.68);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 34px rgba(0, 0, 0, 0.42);
  }

  body.theme-dark-active .mobile-tabbar button.search-tab strong {
    display: none;
  }

  body.theme-dark-active .mobile-tabbar button.search-tab .tab-glyph {
    width: 30px;
    height: 30px;
  }

  body.theme-dark-active .mobile-tabbar .tab-glyph {
    width: 24px;
    height: 24px;
  }

  body.theme-dark-active .mobile-tabbar strong {
    font-size: 11px;
    line-height: 1;
    font-weight: 760;
  }

  body.theme-dark-active .mobile-tabbar em {
    position: absolute;
    top: 7px;
    right: 7px;
    min-width: 22px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid rgba(28, 28, 30, 0.95);
    border-radius: 999px;
    background: #ff453a;
    color: #fff;
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
  }

  /* Native Telegram iOS list and tab metrics */
  body.theme-dark-active .sidebar {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  }

  body.theme-dark-active .topbar {
    min-height: 96px;
    padding: calc(28px + env(safe-area-inset-top)) 28px 8px;
  }

  body.theme-dark-active .topbar h1 {
    gap: 8px;
    font-size: 22px;
    font-weight: 700;
  }

  body.theme-dark-active .topbar h1::before {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  body.theme-dark-active .dialog-filters {
    min-height: 44px;
    margin: 0 34px 5px;
    padding: 3px;
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(44, 44, 46, 0.66);
  }

  body.theme-dark-active .dialog-filters button {
    height: 38px;
    min-height: 38px;
    font-size: 17px;
    font-weight: 650;
  }

  body.theme-dark-active .dialog-button {
    grid-template-columns: 70px minmax(0, 1fr) minmax(42px, max-content);
    grid-template-rows: 24px 22px 22px;
    min-height: 84px;
    padding: 8px 18px 8px 18px;
    gap: 0 8px;
  }

  body.theme-dark-active .dialog-avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }

  body.theme-dark-active .dialog-title {
    font-size: 17px;
    line-height: 1.14;
    font-weight: 600;
    color: #f5f5f7;
  }

  body.theme-dark-active .dialog-preview {
    font-size: 16px;
    line-height: 1.18;
    font-weight: 400;
    color: #8e8e93;
  }

  body.theme-dark-active .dialog-date {
    font-size: 15px;
    font-weight: 400;
  }

  body.theme-dark-active .unread,
  body.theme-dark-active .dialog-muted,
  body.theme-dark-active .muted-unread {
    min-width: 27px;
    height: 27px;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 700;
  }

  body.theme-dark-active .dialog-button.muted .dialog-title {
    color: rgba(245, 245, 247, 0.58);
    font-weight: 600;
  }

  body.theme-dark-active .mobile-tabbar {
    left: 34px;
    right: 34px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(0, 1fr)) 70px;
    min-height: 72px;
    padding: 5px;
  }

  body.theme-dark-active .mobile-tabbar::before {
    inset: 0 78px 0 0;
    background: rgba(28, 28, 30, 0.7);
  }

  body.theme-dark-active .mobile-tabbar button {
    height: 62px;
    min-height: 62px;
    gap: 2px;
  }

  body.theme-dark-active .mobile-tabbar button.active {
    background: rgba(118, 118, 128, 0.38);
  }

  body.theme-dark-active .mobile-tabbar button.search-tab {
    width: 66px;
    height: 66px;
    min-height: 66px;
    margin-left: 8px;
  }

  body.theme-dark-active .mobile-tabbar .tab-glyph {
    width: 25px;
    height: 25px;
  }

  body.theme-dark-active .mobile-tabbar button.search-tab .tab-glyph {
    width: 32px;
    height: 32px;
  }

  body.theme-dark-active .tab-avatar {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #64d2ff, #2f83ff);
    color: #fff;
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
  }

  body.theme-dark-active .mobile-tabbar strong {
    font-size: 11px;
    font-weight: 650;
  }

  body.theme-dark-active .mobile-tabbar em {
    top: 7px;
    right: 6px;
    min-width: 24px;
    height: 20px;
    font-size: 12px;
    font-weight: 700;
  }

  body.theme-dark-active .conversation {
    grid-template-rows: auto auto 1fr auto;
    background: #050505;
    box-shadow: -18px 0 44px rgba(0, 0, 0, 0.55);
  }

  body.theme-dark-active .chat-header {
    min-height: 82px;
    padding: calc(22px + env(safe-area-inset-top)) 10px 9px;
    border-bottom: 1px solid rgba(84, 84, 88, 0.28);
    background: rgba(0, 0, 0, 0.62);
  }

  body.theme-dark-active .chat-header h2 {
    color: #fff;
    font-size: 20px;
    font-weight: 820;
  }

  body.theme-dark-active .chat-header p {
    color: #8e8e93;
  }

  body.theme-dark-active #backToDialogs,
  body.theme-dark-active #toggleMessageSearch {
    width: 48px;
    min-height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    background: rgba(28, 28, 30, 0.72);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  body.theme-dark-active .pinned-message-bar {
    min-height: 44px;
    border-bottom: 1px solid rgba(84, 84, 88, 0.28);
    background: rgba(28, 28, 30, 0.72);
  }

  body.theme-dark-active .message-list {
    padding: 12px 10px 16px;
    background: #050505;
  }

  body.theme-dark-active .composer {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 9px 10px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(84, 84, 88, 0.34);
    background: rgba(0, 0, 0, 0.68);
  }

  body.theme-dark-active .composer textarea {
    border: 1px solid rgba(118, 118, 128, 0.36);
    background: rgba(28, 28, 30, 0.9);
    color: #fff;
  }
}

@media (max-width: 760px) {
  body.theme-light-active .chat-view,
  body.theme-light-active .sidebar {
    background: #f2f2f7;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  }

  body.theme-light-active .sidebar {
    grid-template-rows: auto auto auto 1fr auto;
  }

  body.theme-light-active .topbar,
  body.theme-light-active .search-box,
  body.theme-light-active .dialog-filters,
  body.theme-light-active .mobile-tabbar {
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
  }

  body.theme-light-active .topbar {
    display: grid;
    grid-template-columns: 82px 1fr 118px;
    align-items: center;
    min-height: 96px;
    padding: calc(28px + env(safe-area-inset-top)) 28px 8px;
    border-bottom: 0;
    background: rgba(242, 242, 247, 0.72);
  }

  body.theme-light-active .topbar > div:first-child {
    display: contents;
  }

  body.theme-light-active .topbar h1 {
    grid-column: 2;
    justify-self: center;
    display: inline-grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 8px;
    color: #111;
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
  }

  body.theme-light-active .topbar h1::before {
    content: attr(data-initial);
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 2px solid rgba(52, 199, 89, 0.86);
    border-radius: 50%;
    background: linear-gradient(145deg, #64d2ff, #2f83ff);
    color: #fff;
    font-size: 14px;
    font-weight: 820;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.26);
  }

  body.theme-light-active .topbar h1[data-section="settings"]::before {
    display: none;
  }

  body.theme-light-active .topbar p {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    min-height: 48px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid rgba(60, 60, 67, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #111;
    display: grid;
    place-items: center;
    font-size: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 22px rgba(17, 24, 39, 0.08);
  }

  body.theme-light-active .topbar p::before {
    content: "编辑";
    font-size: 17px;
    font-weight: 650;
  }

  body.theme-light-active .toolbar-actions {
    grid-column: 3;
    justify-self: end;
    display: grid;
    grid-template-columns: 48px 48px;
    gap: 0;
    width: 104px;
    min-height: 48px;
    padding: 0 4px;
    border: 1px solid rgba(60, 60, 67, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 22px rgba(17, 24, 39, 0.08);
    overflow: visible;
  }

  body.theme-light-active .toolbar-actions select,
  body.theme-light-active .toolbar-actions #addAccount,
  body.theme-light-active .toolbar-actions #manageAccount,
  body.theme-light-active .toolbar-actions #notifyButton,
  body.theme-light-active .toolbar-actions #statusButton,
  body.theme-light-active .toolbar-actions #usersButton,
  body.theme-light-active .toolbar-actions #lockButton,
  body.theme-light-active .toolbar-actions #refreshDialogs {
    display: none;
  }

  body.theme-light-active .toolbar-actions #mobileMoreActions,
  body.theme-light-active .toolbar-actions #newChatButton {
    display: grid;
    width: 48px;
    height: 46px;
    min-height: 46px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #111;
    box-shadow: none;
  }

  body.theme-light-active .toolbar-actions #mobileMoreActions {
    order: 1;
    border-right: 1px solid rgba(60, 60, 67, 0.14);
    border-radius: 999px 0 0 999px;
  }

  body.theme-light-active .toolbar-actions #newChatButton {
    order: 2;
  }

  body.theme-light-active .search-box {
    position: relative;
    z-index: 3;
    grid-template-columns: 1fr;
    display: none;
    margin: 0 34px 8px;
    padding: 0;
    background: transparent;
  }

  body.theme-light-active .chat-view.list-search-open .search-box {
    display: grid;
  }

  body.theme-light-active .search-box input {
    height: 42px;
    min-height: 42px;
    border: 1px solid rgba(60, 60, 67, 0.11);
    border-radius: 999px;
    background: rgba(229, 229, 234, 0.86);
    color: #111;
    font-size: 16px;
    text-align: center;
  }

  body.theme-light-active .search-box button {
    display: none;
  }

  body.theme-light-active .dialog-filters {
    position: relative;
    z-index: 3;
    gap: 0;
    min-height: 44px;
    margin: 0 34px 5px;
    padding: 3px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 999px;
    background: rgba(229, 229, 234, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  }

  body.theme-light-active .dialog-filters button {
    height: 38px;
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #111;
    font-size: 17px;
    font-weight: 650;
  }

  body.theme-light-active .dialog-filters button.active {
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    box-shadow: 0 1px 3px rgba(60, 60, 67, 0.18);
  }

  body.theme-light-active .dialog-list {
    margin: 0;
    padding: 0 0 calc(104px + env(safe-area-inset-bottom));
    border-radius: 0;
    background: #fff;
  }

  body.theme-light-active .dialog-button {
    grid-template-columns: 70px minmax(0, 1fr) minmax(42px, max-content);
    grid-template-rows: 24px 22px 22px;
    min-height: 84px;
    padding: 8px 18px;
    gap: 0 8px;
    border: 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.16);
    border-radius: 0;
    background: #fff;
  }

  body.theme-light-active .dialog-button:hover,
  body.theme-light-active .dialog-button.active {
    background: #f2f2f7;
  }

  body.theme-light-active .dialog-avatar {
    grid-row: 1 / 4;
    width: 60px;
    height: 60px;
    font-size: 24px;
    box-shadow: none;
  }

  body.theme-light-active .dialog-title {
    grid-column: 2 / 3;
    grid-row: 1;
    align-self: end;
    color: #111;
    font-size: 17px;
    line-height: 1.14;
    font-weight: 600;
  }

  body.theme-light-active .dialog-preview {
    grid-column: 2 / 3;
    grid-row: 2 / 4;
    align-self: start;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    color: #8e8e93;
    font-size: 16px;
    line-height: 1.18;
    font-weight: 400;
  }

  body.theme-light-active .dialog-date {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    color: #8e8e93;
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
  }

  body.theme-light-active .unread,
  body.theme-light-active .dialog-muted,
  body.theme-light-active .muted-unread {
    grid-column: 3;
    grid-row: 2 / 4;
    align-self: center;
    justify-self: end;
    min-width: 27px;
    height: 27px;
    padding: 0 8px;
    border: 0;
    border-radius: 999px;
    background: #0a84ff;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
  }

  body.theme-light-active .dialog-button.muted .dialog-title {
    color: rgba(60, 60, 67, 0.6);
    font-weight: 600;
  }

  body.theme-light-active .dialog-button.muted .dialog-preview,
  body.theme-light-active .dialog-button.muted .dialog-date {
    color: rgba(60, 60, 67, 0.48);
  }

  body.theme-light-active .dialog-button.muted .dialog-avatar {
    opacity: 0.62;
  }

  body.theme-light-active .dialog-button.muted .unread,
  body.theme-light-active .dialog-muted,
  body.theme-light-active .muted-unread {
    border: 1px solid rgba(142, 142, 147, 0.28);
    background: rgba(142, 142, 147, 0.14);
    color: rgba(60, 60, 67, 0.5);
  }

  body.theme-light-active .mobile-tabbar {
    position: fixed;
    left: 34px;
    right: 34px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 18;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) 70px;
    align-items: center;
    min-height: 72px;
    padding: 5px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.theme-light-active .mobile-tabbar::before,
  body.theme-light-active .mobile-tabbar .search-tab {
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
  }

  body.theme-light-active .mobile-tabbar::before {
    content: "";
    position: absolute;
    inset: 0 78px 0 0;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 14px 34px rgba(17, 24, 39, 0.14);
  }

  body.theme-light-active .mobile-tabbar button {
    position: relative;
    z-index: 1;
    display: grid;
    height: 62px;
    min-height: 62px;
    place-items: center;
    gap: 2px;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    color: #111;
  }

  body.theme-light-active .mobile-tabbar button.active {
    background: rgba(118, 118, 128, 0.18);
    color: #0a84ff;
  }

  body.theme-light-active .mobile-tabbar button.search-tab {
    width: 66px;
    height: 66px;
    min-height: 66px;
    margin-left: 8px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 14px 34px rgba(17, 24, 39, 0.14);
  }

  body.theme-light-active .mobile-tabbar button.search-tab strong {
    display: none;
  }

  body.theme-light-active .mobile-tabbar .tab-glyph {
    width: 25px;
    height: 25px;
  }

  body.theme-light-active .mobile-tabbar button.search-tab .tab-glyph {
    width: 32px;
    height: 32px;
  }

  body.theme-light-active .tab-avatar {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #64d2ff, #2f83ff);
    color: #fff;
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
  }

  body.theme-light-active .mobile-tabbar strong {
    color: currentColor;
    font-size: 11px;
    line-height: 1;
    font-weight: 650;
  }

  body.theme-light-active .mobile-tabbar em {
    position: absolute;
    top: 7px;
    right: 6px;
    display: grid;
    min-width: 24px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    background: #ff3b30;
    color: #fff;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar {
    left: 34px;
    right: 34px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(0, 1fr)) 74px;
    min-height: 74px;
    padding: 4px;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar::before {
    inset: 0 84px 0 0;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar button {
    grid-template-rows: 31px 13px;
    align-content: center;
    justify-items: center;
    gap: 3px;
    height: 66px;
    min-height: 66px;
    padding: 5px 0 6px;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar button.active {
    width: 84px;
    justify-self: center;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar button.search-tab {
    width: 68px;
    height: 68px;
    min-height: 68px;
    margin-left: 10px;
    padding: 0;
    place-items: center;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar .tab-glyph {
    align-self: end;
    width: 26px;
    height: 26px;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar .icon-chat {
    width: 29px;
    height: 27px;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar button.search-tab .tab-glyph {
    width: 33px;
    height: 33px;
  }

  :is(body.theme-dark-active, body.theme-light-active) .tab-avatar {
    align-self: end;
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar strong {
    align-self: start;
    font-size: 11px;
    line-height: 1;
    font-weight: 650;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar em {
    top: 7px;
    right: 16px;
    min-width: 23px;
    height: 20px;
    padding: 0 5px;
    font-size: 12px;
    line-height: 1;
  }
}

@media (max-width: 760px) {
  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar button {
    isolation: isolate;
    background: transparent !important;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar button.active:not(.search-tab) {
    width: 86px;
    justify-self: center;
    background: transparent !important;
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar button.active:not(.search-tab)::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 2px;
    z-index: -1;
    width: 84px;
    height: 62px;
    border-radius: 999px;
    transform: translateX(-50%);
  }

  body.theme-dark-active .mobile-tabbar button.active:not(.search-tab)::before {
    background: rgba(118, 118, 128, 0.36);
  }

  body.theme-light-active .mobile-tabbar button.active:not(.search-tab)::before {
    background: rgba(118, 118, 128, 0.18);
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar .icon-chat {
    transform: translateY(1px);
  }

  :is(body.theme-dark-active, body.theme-light-active) .mobile-tabbar em {
    top: 6px;
    right: 15px;
  }
}
