:root {
  color-scheme: light;
  font-family: "Segoe UI Variable Display", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 117, 255, 0.16), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(20, 48, 100, 0.14), transparent 24%),
    linear-gradient(180deg, #f5f9ff 0%, #eaf1fb 100%);
  color: #10213f;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Step 1.233: mobile auth must stay readable and tappable, not a clipped tab rail. */
.auth-card .auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  padding: 6px;
  border-radius: 22px;
}

.auth-card .auth-tab {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 11px 8px;
  color: #c7d5e8;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  word-break: normal;
}

.auth-card .auth-tab.active {
  color: #f8fbff;
  background: linear-gradient(135deg, #1f95ff 0%, #2cc4de 100%);
  box-shadow: 0 12px 28px rgba(31, 149, 255, 0.24);
}

.auth-card .auth-form input,
.auth-card .auth-form textarea {
  border: 1px solid rgba(112, 137, 174, 0.2);
  background: #f4f8fe;
  color: #10243d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.auth-card .auth-form input::placeholder,
.auth-card .auth-form textarea::placeholder {
  color: #7d8da1;
  opacity: 1;
}

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

  .auth-card .auth-card-head {
    gap: 8px;
    margin-bottom: 18px;
  }

  .auth-card .auth-card-summary {
    line-height: 1.5;
  }

  .auth-card .auth-tabs {
    margin: 4px 0 2px;
  }

  .auth-card .auth-tab {
    min-height: 46px;
    font-size: 0.86rem;
  }

  .auth-card .auth-form {
    gap: 13px;
  }
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
}

.call-audio-sink {
  position: fixed;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

code {
  font-family: "Cascadia Code", "Fira Code", monospace;
}

.web-shell {
  min-height: 100vh;
  padding: 20px 20px 28px;
}

.web-header,
.web-main,
.authenticated-main,
.dashboard-grid,
.sessions-table,
.feature-inline-list,
.action-grid {
  width: min(1180px, 100%);
  margin: 0 auto;
}

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

.web-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 14px 8px 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 40px rgba(16, 33, 63, 0.08);
}

.asya-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  line-height: 1;
}

.asya-logo-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: block;
  filter: drop-shadow(0 12px 24px rgba(46, 166, 255, 0.2));
}

.asya-logo-word {
  color: #10213f;
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.web-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switch,
.ghost-link,
.secondary-link,
.submit-button {
  border: 0;
  border-radius: 16px;
  text-decoration: none;
}

.lang-switch,
.ghost-link,
.button-link {
  background: rgba(255, 255, 255, 0.8);
  color: #10213f;
  cursor: pointer;
  padding: 12px 16px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
}

.web-main {
  padding: 36px 0 28px;
}

.web-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 432px);
  gap: 24px;
  align-items: start;
}

.hero-copy-block,
.auth-card,
.hero-panel,
.dashboard-card {
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(149, 169, 205, 0.28);
  box-shadow: 0 24px 60px rgba(16, 33, 63, 0.08);
  backdrop-filter: blur(14px);
}

.hero-copy-block,
.hero-panel {
  padding: 36px;
}

.hero-chip,
.section-label,
.inline-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-chip,
.section-label {
  background: rgba(16, 33, 63, 0.06);
  padding: 8px 12px;
  color: #355079;
}

.hero-copy-block h1,
.hero-panel h1 {
  margin: 18px 0 12px;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.95;
  display: grid;
  gap: 8px;
}

.accent-line {
  color: #0057d8;
}

.hero-text,
.hero-note,
.runtime-note {
  max-width: 58ch;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.auth-hero-grid {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.auth-hero-pill {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(9, 25, 58, 0.045);
  border: 1px solid rgba(82, 112, 168, 0.12);
  color: #294465;
  line-height: 1.55;
}

.hero-note,
.runtime-note {
  color: #3e5375;
}

.danger-note {
  color: #b42318;
}

.hidden-file-input {
  display: none;
}

.feature-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 18px;
}

.inline-pill {
  background: rgba(0, 87, 216, 0.08);
  color: #0d4db7;
  padding: 10px 12px;
  text-transform: none;
  letter-spacing: 0;
}

.auth-card {
  padding: 30px;
  min-width: 0;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.92));
}

.auth-card-head {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-card-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
  color: #12284c;
}

.auth-card-kicker {
  margin: 0;
  color: #4f6991;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card-summary {
  margin: 0;
  color: #4a6284;
  line-height: 1.55;
  max-width: 34ch;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.auth-tab {
  border: 0;
  border-radius: 16px;
  background: rgba(16, 33, 63, 0.05);
  color: #355079;
  padding: 13px 12px;
  cursor: pointer;
  min-height: 48px;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.auth-tab.active {
  background: #10213f;
  color: white;
  transform: translateY(-1px);
}

.auth-hint {
  margin: 18px 0;
  color: #48607f;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form span {
  color: #2f4668;
  font-size: 0.95rem;
}

.auth-form input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(96, 125, 168, 0.26);
  padding: 14px 16px;
  background: rgba(248, 251, 255, 0.9);
  min-height: 52px;
}

.submit-button {
  background: linear-gradient(135deg, #0057d8 0%, #1e78ff 100%);
  color: white;
  padding: 15px 18px;
  cursor: pointer;
  font-weight: 700;
}

.submit-button:disabled,
.button-link:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.status-banner {
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.status-banner.error {
  background: rgba(194, 51, 56, 0.1);
  color: #9f2328;
}

.auth-suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.auth-suggestion-chip {
  border: 1px solid rgba(31, 149, 255, 0.22);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.86);
  color: #0d61c8;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(16, 33, 63, 0.08);
}

.auth-suggestion-chip:hover,
.auth-suggestion-chip:focus-visible {
  border-color: rgba(31, 149, 255, 0.48);
  background: #ffffff;
  color: #034ca4;
}

.challenge-box {
  border-radius: 18px;
  background: rgba(16, 33, 63, 0.05);
  padding: 14px;
  display: grid;
  gap: 6px;
  color: #294465;
}

.authenticated-main {
  display: grid;
  gap: 22px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.secondary-link,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.messenger-shell {
  display: grid;
  gap: 24px;
}

.stories-strip {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(243, 248, 255, 0.92));
  border: 1px solid rgba(149, 169, 205, 0.28);
  box-shadow: 0 18px 42px rgba(16, 33, 63, 0.08);
}

.messenger-room > .stories-strip {
  gap: 12px;
  margin: 16px 16px 0;
  padding: 16px 18px;
  border-radius: 20px;
}

.messenger-room > .stories-strip .stories-strip-head > div p:last-child,
.messenger-room > .stories-strip .story-filter-tabs {
  display: none;
}

.stories-strip-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.story-filter-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(232, 239, 250, 0.95);
}

.story-filter-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #496280;
  padding: 8px 12px;
  cursor: pointer;
}

.story-filter-tab.active {
  background: #10213f;
  color: white;
}

.stories-strip-head h3,
.story-viewer-head h3 {
  margin: 4px 0 6px;
  font-size: 1.15rem;
}

.stories-strip-head p,
.story-viewer-head p,
.story-viewer-caption {
  margin: 0;
  color: #506887;
}

.stories-strip-body {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.story-pill,
.story-pill-button {
  border: 0;
  background: none;
  text-align: left;
}

.story-pill {
  min-width: 168px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(244, 248, 255, 0.96);
  border: 1px solid rgba(127, 152, 191, 0.24);
  cursor: pointer;
}

.story-pill.own {
  min-width: 220px;
  cursor: default;
}

.story-pill.fresh {
  box-shadow: inset 0 0 0 2px rgba(0, 87, 216, 0.2);
}

.story-pill-button {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.story-pill-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d63e6 0%, #3aa0ff 100%);
  color: white;
  font-weight: 800;
  flex: 0 0 auto;
}

.story-pill-copy {
  display: grid;
  gap: 2px;
}

.story-pill-copy strong {
  color: #12284a;
}

.story-pill-copy span,
.story-ready-note {
  color: #5c7393;
  font-size: 0.9rem;
}

.call-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 87, 216, 0.12);
  color: #0d5fd7;
  font-size: 0.66rem;
  font-weight: 700;
}

.story-caption-input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(110, 135, 174, 0.26);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
}

.story-draft-preview {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(230, 238, 250, 0.9);
  min-height: 140px;
}

.story-draft-preview img,
.story-draft-preview video {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.story-composer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.story-composer-field {
  display: grid;
  gap: 6px;
}

.story-composer-field span {
  color: #536b8a;
  font-size: 0.82rem;
  font-weight: 600;
}

.story-composer-field select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(110, 135, 174, 0.26);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #10213f;
}

.secret-chat-workspace {
  display: grid;
  gap: 14px;
}

.secret-chat-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(12, 22, 42, 0.95), rgba(16, 74, 146, 0.92));
  color: #eef4ff;
}

.secret-chat-banner p,
.secret-chat-banner .sidebar-eyebrow {
  color: rgba(238, 244, 255, 0.76);
}

.secret-chat-banner-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  align-content: start;
}

.secret-message-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(123, 146, 186, 0.18);
  box-shadow: 0 12px 32px rgba(18, 40, 74, 0.08);
}

.secret-message-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.secret-message-meta {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.secret-envelope-preview {
  margin: 0;
  padding: 14px;
  border-radius: 18px;
  background: rgba(8, 18, 34, 0.96);
  color: #dbebff;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.secret-composer-note {
  margin-top: 8px;
}

.global-call-dock {
  width: min(1340px, calc(100% - 24px));
  margin: 0 auto 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(16, 33, 63, 0.95), rgba(9, 89, 185, 0.92));
  color: white;
  box-shadow: 0 18px 44px rgba(9, 32, 78, 0.24);
}

.global-call-dock {
  flex-wrap: wrap;
}

.global-call-dock-copy {
  display: grid;
  gap: 2px;
}

.global-call-dock-copy strong {
  font-size: 1.02rem;
}

.global-call-dock-copy span {
  color: rgba(255, 255, 255, 0.78);
}

.global-call-workspace {
  width: 100%;
  display: grid;
  gap: 14px;
  padding-top: 6px;
}

.global-call-workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.global-call-workspace-head span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
}

.global-call-history-list {
  display: grid;
  gap: 10px;
}

.global-call-history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
}

.floating-call-workspace {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20, 28, 41, 0.98), rgba(14, 21, 31, 0.98));
  color: #f5f8ff;
  box-shadow: 0 30px 80px rgba(6, 10, 18, 0.4);
  border: 1px solid rgba(130, 154, 191, 0.22);
  backdrop-filter: blur(16px);
}

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

.global-call-history-item.floating {
  background: rgba(255, 255, 255, 0.08);
}

.call-video-sink {
  display: none;
}

.call-video-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(180px, 0.85fr);
  gap: 12px;
  width: 100%;
  margin-top: 14px;
}

.call-video-stage.compact {
  margin-top: 10px;
}

.call-video-stage.floating,
.call-video-stage.rail {
  margin-top: 12px;
}

.call-video-tile {
  position: relative;
  min-height: 172px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(115, 165, 255, 0.28), transparent 52%),
    linear-gradient(145deg, rgba(10, 21, 44, 0.96), rgba(28, 49, 85, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.call-video-tile.local {
  min-height: 140px;
}

.call-video-tile-media {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  background: transparent;
}

.call-video-placeholder {
  display: grid;
  gap: 6px;
  align-content: end;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 16px;
  color: rgba(255, 255, 255, 0.88);
}

.call-video-placeholder strong {
  font-size: 0.96rem;
}

.call-video-placeholder span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.84rem;
}

.call-summary-card.inverse {
  background: rgba(255, 255, 255, 0.12);
}

.call-summary-card.inverse span {
  color: rgba(255, 255, 255, 0.72);
}

.call-summary-card.inverse strong {
  color: #f5f8ff;
}

.call-filter-tabs.inverse {
  background: rgba(255, 255, 255, 0.12);
}

.call-filter-tabs.inverse .story-filter-tab {
  color: rgba(255, 255, 255, 0.8);
}

.call-filter-tabs.inverse .story-filter-tab.active {
  background: rgba(255, 255, 255, 0.96);
  color: #10213f;
}

.story-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 14, 24, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.media-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 14, 24, 0.86);
  backdrop-filter: blur(14px);
}

.story-viewer {
  width: min(720px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 28px;
  background: rgba(14, 20, 30, 0.96);
  color: #f5f8ff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.4);
}

.media-viewer {
  width: min(860px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 28px;
  background: rgba(14, 20, 30, 0.96);
  color: #f5f8ff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
}

.story-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(24px, 1fr));
  gap: 8px;
}

.story-progress-segment {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.story-progress-segment.seen {
  background: rgba(132, 197, 255, 0.56);
}

.story-progress-segment.active {
  background: #ffffff;
}

.story-viewer-head,
.media-viewer-head,
.story-viewer-actions,
.active-call-panel {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.story-viewer-media {
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-viewer-stage {
  min-height: 360px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.story-viewer-media img,
.story-viewer-media video {
  max-width: 100%;
  max-height: 72vh;
  display: block;
}

.media-viewer-image,
.media-viewer-video {
  max-width: 100%;
  max-height: 74vh;
  display: block;
  object-fit: contain;
}

.media-viewer-caption {
  margin: 0;
  color: rgba(245, 248, 255, 0.82);
}

.media-viewer-counter {
  display: inline-flex;
  margin-top: 6px;
  color: rgba(245, 248, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
}

.media-viewer-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.media-viewer-thumb {
  position: relative;
  width: 74px;
  height: 58px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.media-viewer-thumb.active {
  border-color: rgba(132, 197, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(132, 197, 255, 0.18);
}

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

.media-viewer-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(245, 248, 255, 0.72);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.media-viewer-thumb-kind {
  position: absolute;
  right: 5px;
  bottom: 5px;
  z-index: 1;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-viewer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.story-group-switcher {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.story-viewers-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

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

.story-viewer-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: #dce8ff;
}

.story-viewer-row-copy {
  display: grid;
  gap: 4px;
}

.story-viewer-row-copy span {
  color: rgba(220, 232, 255, 0.72);
  font-size: 0.88rem;
}

.room-lifecycle-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 14, 24, 0.58);
  backdrop-filter: blur(12px);
}

.room-lifecycle-confirm {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(245, 249, 255, 0.98);
  color: #10213f;
  box-shadow: 0 28px 80px rgba(8, 14, 24, 0.32);
}

.room-lifecycle-confirm h3 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.45rem);
}

.room-lifecycle-confirm p {
  margin: 0;
  color: #5b6d8b;
  line-height: 1.5;
}

.room-lifecycle-confirm .compact-actions {
  justify-content: flex-end;
}

.call-filter-tabs {
  width: fit-content;
}

.call-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}

.call-summary-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(239, 245, 253, 0.88);
}

.call-summary-card span {
  color: #607896;
  font-size: 0.8rem;
}

.call-summary-card strong {
  color: #13284a;
  font-size: 1.05rem;
}

.active-call-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.active-call-panel div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(237, 243, 253, 0.82);
}

.active-call-panel span {
  color: #607896;
  font-size: 0.82rem;
}

.active-call-panel strong {
  color: #13284a;
}

.call-history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.call-history-copy {
  display: grid;
  gap: 2px;
}

.call-history-copy span {
  color: #647b98;
  font-size: 0.88rem;
}

.call-control-row {
  margin: 10px 0 14px;
}

.messenger-header {
  width: min(1340px, calc(100% - 24px));
}

.messenger-layout {
  width: min(1340px, calc(100% - 24px));
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}

.messenger-layout.desktop-rail-collapsed {
  grid-template-columns: 300px minmax(0, 1fr);
}

.messenger-layout.desktop-rail-collapsed .messenger-rail {
  display: none;
}

.messenger-sidebar,
.messenger-room,
.messenger-rail {
  min-height: calc(100vh - 140px);
}

.messenger-sidebar {
  padding: 18px 14px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(24, 30, 38, 0.98), rgba(20, 24, 31, 0.98));
  border: 1px solid rgba(81, 94, 114, 0.35);
  box-shadow: 0 24px 60px rgba(3, 7, 18, 0.24);
}

.sidebar-frame {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 14px;
  min-height: inherit;
}

.sidebar-appnav {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 8px 4px;
  border-radius: 22px;
  background: rgba(45, 53, 63, 0.72);
  border: 1px solid rgba(104, 121, 145, 0.18);
}

.sidebar-brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 4px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(53, 214, 198, 0.12), rgba(46, 166, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(110, 141, 255, 0.16);
}

.sidebar-brand-mark .asya-logo-mark {
  width: 38px;
  height: 38px;
}

.sidebar-content {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.sidebar-account {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 16px;
  background: rgba(38, 45, 54, 0.92);
  border: 1px solid rgba(104, 121, 145, 0.18);
}

.sidebar-account-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sidebar-account-copy strong,
.sidebar-account-copy span,
.sidebar-account-state {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-copy strong {
  color: #f4f7fb;
  font-size: 0.9rem;
  line-height: 1.15;
}

.sidebar-account-copy span,
.sidebar-account-state {
  color: #8ea4c0;
  font-size: 0.74rem;
}

.sidebar-account-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sidebar-navicon {
  display: grid;
  justify-items: center;
  gap: 0;
  border: 0;
  border-radius: 18px;
  padding: 12px 4px;
  background: transparent;
  color: #9fb3cf;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.sidebar-navicon:hover {
  background: rgba(118, 138, 168, 0.12);
  transform: translateY(-1px);
}

.sidebar-navicon.active {
  background: linear-gradient(180deg, rgba(50, 145, 255, 0.22), rgba(29, 111, 213, 0.18));
  color: #eef6ff;
}

.sidebar-navicon-glyph {
  font-size: 1.15rem;
  line-height: 1;
}

.sidebar-navicon-label {
  display: none;
}

.messenger-room {
  padding: 0;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(28, 32, 39, 0.98), rgba(22, 26, 32, 0.98));
  border: 1px solid rgba(81, 94, 114, 0.28);
  box-shadow: 0 24px 60px rgba(3, 7, 18, 0.2);
}

.rail-card {
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(45, 53, 63, 0.96), rgba(34, 40, 48, 0.96));
  border: 1px solid rgba(104, 121, 145, 0.24);
  box-shadow: 0 24px 60px rgba(6, 9, 16, 0.18);
  backdrop-filter: blur(14px);
}

.messenger-rail {
  display: grid;
  gap: 18px;
}

.entity-card,
.contact-card {
  display: grid;
  gap: 16px;
}

.entity-card-head,
.contact-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.entity-card-head h3,
.contact-card-head strong {
  margin: 0 0 4px;
}

.entity-card-head p,
.contact-card-head p {
  margin: 0;
  color: #92a7c2;
}

.entity-meta-grid,
.contact-card-meta {
  display: grid;
  gap: 12px;
}

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

.entity-meta-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.entity-meta-grid span {
  color: #91a6c2;
  font-size: 0.82rem;
}

.entity-meta-grid strong {
  color: #f4f8ff;
}

.rail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-contact-list {
  display: grid;
  gap: 10px;
}

.sticker-panel,
.sticker-pack-tabs,
.sticker-grid {
  display: grid;
  gap: 12px;
}

.sticker-pack-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sticker-pack-tab,
.sticker-picker-item,
.message-sticker {
  border: 0;
  cursor: pointer;
}

.sticker-pack-tab {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #e8f2ff;
}

.sticker-pack-tab.active {
  background: rgba(59, 140, 255, 0.2);
}

.sticker-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sticker-picker-item {
  display: grid;
  justify-items: center;
  gap: 6px;
  border-radius: 16px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #dce9fb;
}

.sticker-picker-item img,
.message-sticker-image {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.message-sticker {
  display: inline-grid;
  justify-items: center;
  padding: 0;
  background: transparent;
}

.message-sticker-image {
  width: 112px;
  height: 112px;
}

.quick-contact-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 18px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #ecf4ff;
  cursor: pointer;
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.contact-stack {
  display: grid;
  gap: 20px;
}

.settings-contact-section {
  display: grid;
  gap: 14px;
}

.contact-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(40, 47, 56, 0.84);
  border: 1px solid rgba(104, 121, 145, 0.18);
}

.contact-card.blocked {
  background: rgba(53, 38, 46, 0.9);
  border-color: rgba(196, 95, 130, 0.24);
}

.contact-card-meta {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.contact-card-actions {
  align-items: stretch;
}

.person-search-card {
  display: grid;
  gap: 10px;
}

.person-search-main {
  width: 100%;
}

.person-search-actions {
  justify-content: flex-start;
}

.sidebar-profile,
.room-header,
.message-meta,
.message-actions,
.composer-box,
.session-item,
.sidebar-nav,
.room-header-status {
  display: flex;
  align-items: center;
}

.sidebar-profile,
.room-header,
.session-item {
  justify-content: space-between;
  gap: 12px;
}

.sidebar-profile h1,
.room-header h2,
.rail-card h3 {
  margin: 6px 0;
}

.sidebar-eyebrow {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8ca2c0;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #b5c2d8;
}

.status-dot.connected {
  background: #2bb673;
}

.status-dot.connecting {
  background: #ffb648;
}

.status-dot.error {
  background: #d9534f;
}

.sidebar-nav {
  gap: 8px;
  margin: 18px 0;
  flex-wrap: wrap;
}

.sidebar-tab {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: rgba(124, 141, 167, 0.12);
  color: #c1cee2;
  cursor: pointer;
}

.sidebar-tab.active {
  background: rgba(32, 169, 255, 0.16);
  color: #7fd0ff;
}

.sidebar-search,
.rail-form,
.composer-peer {
  display: grid;
  gap: 8px;
}

.sidebar-search input,
.rail-form input,
.rail-form textarea,
.composer-box input,
.composer-box textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(104, 121, 145, 0.26);
  padding: 14px 16px;
  background: rgba(235, 241, 250, 0.96);
}

.room-list,
.message-timeline,
.session-list {
  display: grid;
  gap: 10px;
}

.room-list {
  margin-top: 18px;
}

.room-list-item,
.session-item {
  border: 0;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(65, 74, 87, 0.38);
  color: #eef5ff;
  cursor: pointer;
}

.room-list-item span,
.session-item span,
.room-header p,
.runtime-note,
.profile-grid dt {
  color: #9db0ca;
}

.room-list-item strong,
.session-item strong {
  display: block;
  margin-bottom: 4px;
}

.room-list-item.active {
  background: linear-gradient(135deg, rgba(45, 146, 255, 0.2), rgba(73, 194, 255, 0.12));
  border: 1px solid rgba(73, 194, 255, 0.18);
}

.room-list-empty {
  border-radius: 18px;
  padding: 18px;
  background: rgba(242, 246, 252, 0.76);
  color: #46607f;
}

.message-timeline {
  margin: 0;
  padding: 16px 18px;
  min-height: 420px;
  align-content: start;
  background:
    radial-gradient(circle at top right, rgba(93, 112, 140, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(31, 35, 43, 0.94), rgba(20, 23, 29, 0.98));
}

.message-timeline.workspace-landing {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 460px;
  padding: 20px 22px;
  background:
    radial-gradient(circle at top center, rgba(96, 132, 187, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(28, 32, 39, 0.96), rgba(18, 22, 28, 0.98));
}

.workspace-empty-card {
  width: min(520px, 100%);
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(39, 46, 58, 0.9);
  border: 1px solid rgba(104, 121, 145, 0.18);
  box-shadow: 0 24px 54px rgba(4, 12, 25, 0.22);
}

.workspace-empty-card .sidebar-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.workspace-empty-card h3 {
  margin: 0;
  color: #f4f7fb;
  font-size: clamp(1.35rem, 1.8vw, 1.85rem);
}

.workspace-empty-card p:last-of-type {
  margin: 0;
  color: #9db0ca;
  line-height: 1.55;
  max-width: 42ch;
}

.workspace-empty-actions {
  margin-top: 6px;
}

.workspace-empty-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin: 8px 0 4px;
}

.workspace-empty-stats span,
.workspace-empty-stats strong {
  display: grid;
  place-items: center;
  min-height: 36px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(196, 216, 247, 0.1);
}

.workspace-empty-stats span {
  color: #f4f9ff;
  font-size: 1.05rem;
  font-weight: 900;
}

.workspace-empty-stats strong {
  color: #9db0ca;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-card {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(63, 71, 82, 0.88);
  border: 1px solid rgba(92, 104, 121, 0.22);
  max-width: min(72%, 620px);
}

.message-card.self {
  background: linear-gradient(180deg, rgba(54, 92, 112, 0.96), rgba(47, 82, 102, 0.96));
  margin-left: auto;
}

.message-card p {
  margin: 12px 0;
  line-height: 1.6;
  color: #edf4ff;
}

.message-meta,
.message-actions,
.room-header-status {
  gap: 8px;
  flex-wrap: wrap;
}

.message-reactions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ghost-link.danger,
.secondary-link.danger {
  color: #a8232a;
}

.composer-box {
  gap: 12px;
  align-items: end;
}

.composer-box > input,
.composer-peer {
  flex: 1;
}

.rail-card {
  padding: 22px;
}

.rail-card h3,
.sidebar-profile h2,
.room-header h2,
.topbar-copy h1 {
  color: #f3f7ff;
}

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

.settings-overview {
  display: grid;
  gap: 18px;
}

.settings-hero,
.settings-summary-card,
.settings-device-card {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(174, 190, 214, 0.18);
  box-shadow: 0 18px 40px rgba(14, 24, 42, 0.08);
}

.settings-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.settings-hero-copy h3,
.settings-section-head h3 {
  margin: 4px 0 8px;
  color: #173257;
}

.settings-hero-copy p {
  margin: 0;
  color: #506887;
}

.settings-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.settings-summary-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 22px;
}

.settings-summary-card div,
.settings-device-list .session-item > div {
  display: grid;
  gap: 4px;
}

.settings-summary-card span,
.settings-device-list .session-item span,
.settings-section-head p {
  color: #5e7392;
}

.settings-summary-card strong,
.settings-device-list .session-item strong {
  color: #173257;
}

.settings-device-card {
  padding: 20px 22px;
}

.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.profile-grid dd {
  color: #f3f7ff;
}

.profile-form {
  display: grid;
  gap: 10px;
}

.profile-date-field {
  display: grid;
  gap: 8px;
  color: #d8e1ef;
}

.compact-note {
  margin: -2px 0 4px;
  font-size: 0.85rem;
}

.profile-grid dd,
.profile-grid dt {
  margin: 0;
}

.settings-shortcuts {
  display: grid;
  gap: 10px;
}

.sidebar-section-title {
  margin: 16px 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d7a92;
}

.user-search-item {
  border-style: dashed;
}

.session-item.current {
  background: rgba(216, 238, 255, 0.95);
}

.telegram-security-panel {
  gap: 0;
  background:
    radial-gradient(circle at 14% 0%, rgba(45, 169, 255, 0.14), transparent 32%),
    linear-gradient(180deg, #172331 0%, #111b27 100%);
}

.telegram-security-panel > .settings-section-head,
.telegram-security-panel > .profile-grid,
.telegram-security-panel > .compact-actions.section-gap {
  display: none;
}

.telegram-security-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 8px 4px 4px;
}

.telegram-security-avatar {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #35b7ff 0%, #2375ff 100%);
  color: #ffffff;
  font-size: 1.45rem;
  font-weight: 850;
  box-shadow: 0 18px 38px rgba(35, 117, 255, 0.26);
}

.telegram-security-hero h3 {
  margin: 3px 0 5px;
  color: #f7fbff;
  font-size: clamp(1.3rem, 2vw, 1.75rem);
}

.telegram-security-hero p {
  margin: 0;
  color: #93a4b8;
  line-height: 1.45;
}

.security-state-pill,
.telegram-security-value {
  justify-self: end;
  border-radius: 999px;
  padding: 8px 12px;
  background: #213244;
  color: #57bdff;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.telegram-security-list {
  display: grid;
  overflow: hidden;
  border-radius: 22px;
  background: #1d2a38;
  box-shadow: inset 0 0 0 1px rgba(145, 168, 197, 0.08);
}

.telegram-security-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid rgba(145, 168, 197, 0.08);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.telegram-security-row:last-child {
  border-bottom: 0;
}

.telegram-security-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(180deg, #2d3b49, #23313e);
  color: #f7fbff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.telegram-security-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

.telegram-security-row[data-security-row="two-factor"] .telegram-security-icon {
  background: linear-gradient(180deg, #ffb84d, #f08a1a);
  color: #1c1205;
}

.telegram-security-row[data-security-row="sessions"] .telegram-security-icon {
  background: linear-gradient(180deg, #35a7ff, #2079d8);
}

.telegram-security-row[data-security-row="blocked"] .telegram-security-icon {
  background: linear-gradient(180deg, #ff6b6b, #d94848);
}

.telegram-security-row[data-security-row="privacy"] .telegram-security-icon {
  background: linear-gradient(180deg, #8d9aab, #526273);
}

.telegram-security-row[data-security-row="secret-keys"] .telegram-security-icon {
  background: linear-gradient(180deg, #55d67a, #24a85b);
}

.telegram-security-row[data-security-row="data-storage"] .telegram-security-icon {
  background: linear-gradient(180deg, #a98cff, #6f57d8);
}

.telegram-security-row strong {
  display: block;
  color: #f7fbff;
  font-size: 1rem;
}

.telegram-security-row small,
.telegram-security-row em {
  display: block;
  margin-top: 3px;
  color: #8f9dad;
  font-style: normal;
  line-height: 1.35;
}

.telegram-security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
}

.telegram-security-actions .secondary-button {
  width: auto;
}

.messenger-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1280px, 100%);
  margin: 0 auto 18px;
  padding: 14px 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(37, 45, 57, 0.98), rgba(28, 35, 46, 0.98));
  border: 1px solid rgba(98, 121, 150, 0.24);
  box-shadow: 0 28px 64px rgba(8, 12, 18, 0.22);
  backdrop-filter: blur(18px);
}

.mobile-bottom-nav,
.rail-backdrop {
  display: none;
}

.mobile-settings-toggle {
  display: none;
}

.topbar-copy h1 {
  margin: 4px 0 0;
  font-size: clamp(1.05rem, 1.5vw, 1.45rem);
}

.topbar-supporting {
  margin: 4px 0 0;
  color: #bdd0ea;
  font-size: 0.82rem;
}

.topbar-copy h1,
.topbar-copy .sidebar-eyebrow {
  color: #f3f7ff;
}

.messenger-layout {
  display: grid;
  grid-template-columns: minmax(280px, 332px) minmax(0, 1fr) minmax(286px, 326px);
  gap: 16px;
  align-items: start;
}

.room-header-back {
  display: none;
}

.messenger-sidebar,
.messenger-room,
.messenger-rail {
  min-width: 0;
}

.messenger-sidebar,
.messenger-room,
.messenger-rail.open,
.messenger-rail {
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 250, 255, 0.88));
  border: 1px solid rgba(125, 154, 194, 0.16);
  box-shadow: 0 22px 56px rgba(16, 33, 63, 0.08);
  backdrop-filter: blur(18px);
}

.messenger-sidebar,
.messenger-room {
  padding: 18px 18px 20px;
}

.messenger-rail {
  padding: 18px 18px 20px;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px 6px;
}

.avatar-badge,
.room-item-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #14315e;
  background: linear-gradient(135deg, #dcecff, #b8d7ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.avatar-badge {
  width: 52px;
  height: 52px;
  font-size: 1.15rem;
}

.room-item-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.sidebar-profile-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #5b7398;
  font-size: 0.92rem;
}

.sidebar-search input,
.rail-form input,
.composer-box input,
.composer-box textarea {
  border-radius: 18px;
  border: 1px solid rgba(111, 142, 185, 0.24);
  background: rgba(246, 250, 255, 0.96);
  padding: 12px 14px;
}

.room-list {
  margin-top: 12px;
  gap: 6px;
}

.room-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: 18px;
  padding: 10px 11px;
  background: rgba(245, 248, 253, 0.96);
  border: 1px solid rgba(158, 183, 214, 0.14);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.room-list-item.no-tail {
  grid-template-columns: auto minmax(0, 1fr);
}

.room-list-item:hover {
  transform: translateY(-1px);
  background: rgba(240, 246, 255, 1);
}

.room-list-item.active {
  background: linear-gradient(135deg, rgba(0, 97, 232, 0.14), rgba(77, 156, 255, 0.18));
  border-color: rgba(32, 108, 220, 0.26);
}

.room-item-body,
.room-item-head {
  display: grid;
  min-width: 0;
}

.room-item-head {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.room-item-head strong {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.2;
}

.room-item-preview,
.room-item-time {
  font-size: 0.82rem;
  color: #617898;
}

.room-item-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.room-kind-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 86px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(42, 167, 255, 0.14);
  color: #226ea9;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-item-tail {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

.room-item-actions {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 6px;
  min-width: 0;
}

.room-list-delete-action {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 91, 112, 0.2);
  border-radius: 999px;
  background: rgba(255, 91, 112, 0.09);
  color: #d83c57;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0.72;
  transition: opacity 140ms ease, background 140ms ease, transform 140ms ease;
}

.room-list-delete-action:hover,
.room-list-delete-action:focus-visible {
  opacity: 1;
  background: rgba(255, 91, 112, 0.16);
  transform: translateY(-1px);
}

.presence-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.presence-pill.online {
  color: #137046;
  background: rgba(43, 182, 115, 0.14);
}

.presence-pill.offline {
  color: #637791;
  background: rgba(109, 129, 160, 0.12);
}

.presence-pill.blocked {
  color: #ffd4e0;
  background: rgba(199, 69, 116, 0.18);
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(151, 176, 207, 0.16);
}

.room-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.room-header-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.98rem;
  color: #14315e;
  background: linear-gradient(135deg, #dcecff, #b8d7ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.room-header-avatar.online {
  outline: 2px solid rgba(43, 182, 115, 0.5);
  outline-offset: 2px;
}

.room-header-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.room-header .sidebar-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.room-header h2 {
  margin: 0;
  font-size: clamp(1.02rem, 1.7vw, 1.34rem);
  line-height: 1.2;
}

.room-header-status {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.25;
  max-width: 48ch;
}

.room-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.room-header-actions .secondary-button.compact,
.room-header-actions .primary-button.compact-primary {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.settings-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 18px;
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 8px 0 10px;
  background: linear-gradient(180deg, rgba(245, 248, 253, 0.98), rgba(245, 248, 253, 0.82));
  backdrop-filter: blur(12px);
}

.settings-nav-item {
  border: 1px solid rgba(162, 180, 210, 0.18);
  background: rgba(246, 249, 253, 0.94);
  color: #47607f;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  touch-action: manipulation;
}

.settings-nav-item:hover,
.settings-nav-item.active {
  background: #123b8f;
  color: #ffffff;
  border-color: rgba(18, 59, 143, 0.4);
}

.settings-profile-card,
.settings-contacts-card,
.settings-security-card {
  display: grid;
  gap: 18px;
}

.call-audio-sink {
  display: none;
}

.call-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(151, 176, 207, 0.18);
  background: rgba(245, 248, 253, 0.94);
  box-shadow: 0 16px 34px rgba(13, 34, 73, 0.06);
}

.call-banner.active {
  background: rgba(231, 248, 239, 0.94);
}

.call-banner.incoming {
  background: rgba(235, 243, 255, 0.96);
}

.call-banner.error {
  background: rgba(255, 240, 243, 0.96);
  border-color: rgba(227, 71, 101, 0.22);
}

.call-banner.pending {
  background: rgba(244, 246, 251, 0.95);
}

.call-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.call-banner-copy strong {
  color: #193153;
}

.call-banner-copy span {
  color: #637791;
  font-size: 0.84rem;
}

.call-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.message-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 420px;
  padding: 14px 0 112px;
}

.message-card {
  max-width: min(74%, 640px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.message-card.self {
  align-self: flex-end;
}

.message-card:not(.self) {
  align-self: flex-start;
}

.message-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  color: #647a98;
  font-size: 0.76rem;
}

.message-meta.compact-meta {
  gap: 6px;
}

.message-meta.has-toggle {
  width: 100%;
  justify-content: flex-end;
}

.message-card.self .message-meta {
  justify-content: flex-end;
}

.message-menu-button {
  border: 0;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(228, 237, 250, 0.84);
  color: #6a809f;
  cursor: pointer;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.message-menu-button:hover,
.message-menu-button.active {
  background: rgba(208, 225, 247, 0.96);
  color: #173257;
}

.message-bubble {
  border-radius: 22px 22px 22px 10px;
  padding: 12px 14px;
  background: rgba(241, 245, 252, 0.98);
  border: 1px solid rgba(166, 184, 208, 0.14);
  box-shadow: 0 16px 40px rgba(20, 43, 92, 0.06);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-card.self .message-bubble {
  border-radius: 22px 22px 10px 22px;
  background: linear-gradient(180deg, rgba(217, 237, 255, 0.98), rgba(196, 227, 255, 0.96));
}

.message-bubble p {
  margin: 0;
  line-height: 1.55;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.message-card.self .message-actions {
  justify-content: flex-end;
}

.message-card.actions-open .message-bubble {
  box-shadow: 0 20px 42px rgba(20, 43, 92, 0.09);
}

.message-media-block {
  display: grid;
  gap: 10px;
}

.message-image {
  width: min(100%, 320px);
  max-height: 320px;
  object-fit: cover;
  border-radius: 20px;
  display: block;
}

.message-file-link {
  display: inline-grid;
  gap: 3px;
  text-decoration: none;
  color: #173257;
}

.composer-box {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(140, 166, 201, 0.2);
  box-shadow: 0 -8px 24px rgba(16, 33, 63, 0.05);
  backdrop-filter: blur(16px);
}

.composer-box .media-draft-chip {
  grid-column: 1 / -1;
  margin-top: 0;
}

.blocked-chat-notice {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 22px;
  border: 1px solid rgba(224, 92, 92, 0.18);
  background: rgba(255, 245, 245, 0.96);
  box-shadow: 0 -8px 24px rgba(88, 33, 33, 0.06);
  backdrop-filter: blur(16px);
}

.blocked-chat-notice p {
  margin: 0;
  color: #7a3640;
  font-size: 0.92rem;
  line-height: 1.35;
}

.composer-input-wrap {
  min-width: 0;
}

.composer-input-wrap input,
.composer-input-wrap textarea {
  padding: 14px 16px;
}

.composer-input-wrap textarea {
  min-height: 62px;
  max-height: 168px;
  resize: vertical;
  line-height: 1.42;
  font: inherit;
}

.composer-attach {
  min-width: 72px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(229, 240, 255, 0.86);
  color: #173257;
}

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

.rail-card {
  border-radius: 24px;
  background: rgba(245, 248, 253, 0.9);
  border: 1px solid rgba(166, 184, 208, 0.14);
}

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

.room-header-rail {
  display: none;
}

.compact-call-card {
  margin-top: 16px;
}

.call-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.call-history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(242, 246, 252, 0.88);
  color: #4d6484;
}

.call-history-item strong {
  color: #1b365b;
  font-size: 0.92rem;
}

.call-history-item span {
  font-size: 0.82rem;
}

.rail-toggle {
  display: none;
}

.topbar-context-action {
  align-items: center;
  gap: 8px;
  padding-inline: 12px 14px;
}

.topbar-context-action > span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #1288e8, #21b7a8);
  font-weight: 900;
}

.topbar-context-action > strong {
  font-size: 0.86rem;
  line-height: 1;
}

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

  .messenger-rail {
    position: fixed;
    top: 84px;
    right: 14px;
    bottom: 14px;
    width: min(360px, calc(100vw - 28px));
    overflow: auto;
    z-index: 25;
    transform: translateX(calc(100% + 16px));
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .messenger-rail.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .rail-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(7, 11, 18, 0.45);
    border: 0;
    padding: 0;
    margin: 0;
  }

  .rail-toggle,
  .room-header-rail {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  .web-shell {
    padding: 10px 10px 90px;
  }

  .web-main {
    padding-top: 22px;
  }

  .messenger-topbar {
    position: sticky;
    top: 12px;
    z-index: 12;
    margin-bottom: 12px;
    padding: 14px 14px 16px;
    border-radius: 22px;
  }

  .messenger-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .messenger-sidebar,
  .messenger-room {
    padding: 14px;
    border-radius: 22px;
  }

  .messenger-rail {
    border-radius: 22px;
  }

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

  .sidebar-appnav,
  .sidebar-tabs {
    display: none;
  }

  .sidebar-navicon-label {
    font-size: 0.68rem;
  }

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

  .message-card {
    max-width: 92%;
  }

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

  .mobile-bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 35;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 10px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(34, 42, 54, 0.94), rgba(25, 32, 42, 0.97));
    border: 1px solid rgba(118, 138, 168, 0.22);
    box-shadow: 0 16px 36px rgba(7, 11, 18, 0.28);
    backdrop-filter: blur(16px);
    scrollbar-width: none;
  }

  .mobile-bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-bottom-nav-item {
    display: grid;
    gap: 4px;
    justify-items: center;
    align-content: center;
    flex: 0 0 74px;
    min-height: 56px;
    padding: 6px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #c0d1e8;
    cursor: pointer;
  }

  .mobile-bottom-nav-item.active {
    background: rgba(79, 145, 255, 0.18);
    color: #f6fbff;
  }

  .mobile-bottom-nav-glyph {
    font-size: 1rem;
    line-height: 1;
  }

  .mobile-bottom-nav-label {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.68rem;
    line-height: 1.1;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .messenger-topbar,
  .room-header {
    flex-direction: column;
    align-items: stretch;
  }

  .call-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .call-banner-actions {
    width: 100%;
  }

  .call-banner-actions .secondary-button {
    flex: 1 1 160px;
  }

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

  .call-video-tile,
  .call-video-tile.local {
    min-height: 160px;
  }

  .topbar-supporting {
    font-size: 0.84rem;
  }

  .sidebar-appnav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sticker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .room-list-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .room-item-tail {
    display: none;
  }

  .composer-box {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 10px;
  }

  .composer-attach {
    min-width: 60px;
  }

  .attachment-chip {
    display: grid;
    justify-items: start;
    border-radius: 22px;
  }

  .settings-hero,
  .settings-summary-card,
  .entity-meta-grid,
  .contact-card-meta {
    grid-template-columns: 1fr;
  }

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

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

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

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

  .messenger-sidebar,
  .messenger-room,
  .messenger-rail {
    min-height: auto;
  }

  .messenger-rail {
    grid-template-columns: 1fr;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    border-radius: 0;
    padding: 76px 16px 96px;
  }

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

  .composer-box {
    flex-direction: column;
    align-items: stretch;
  }

  .room-header {
    position: sticky;
    top: 84px;
    z-index: 6;
    background: linear-gradient(180deg, rgba(20, 24, 31, 0.98), rgba(20, 24, 31, 0.92));
    padding: 0 0 14px;
  }

  .message-timeline {
    padding-bottom: 12px;
  }

  .settings-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .settings-nav::-webkit-scrollbar {
    display: none;
  }

  .settings-nav-item {
    white-space: nowrap;
  }
}

.button-link {
  min-height: 52px;
}

.button-link.danger {
  background: rgba(194, 51, 56, 0.1);
  color: #a1222c;
}

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

.realtime-grid {
  align-items: start;
}

.dashboard-card {
  padding: 26px;
}

.kv-list,
.next-list,
.sessions-table {
  display: grid;
  gap: 12px;
}

.kv-list div {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(96, 125, 168, 0.16);
}

.kv-list span,
.session-row span {
  color: #5b718e;
}

.next-list {
  padding-left: 18px;
  color: #22395d;
  line-height: 1.6;
}

.dialog-list,
.message-list {
  display: grid;
  gap: 12px;
}

.message-actions-list {
  display: grid;
  gap: 14px;
}

.dialog-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 18px;
  padding: 14px;
  background: rgba(16, 33, 63, 0.04);
  cursor: pointer;
}

.dialog-row.active {
  background: rgba(0, 87, 216, 0.08);
  outline: 1px solid rgba(0, 87, 216, 0.2);
}

.dialog-row div,
.message-meta {
  display: grid;
  gap: 4px;
}

.message-row {
  border-radius: 18px;
  padding: 14px;
  background: rgba(16, 33, 63, 0.04);
}

.message-row p {
  margin: 10px 0 0;
  line-height: 1.6;
}

.empty-state {
  color: #5b718e;
  line-height: 1.6;
}

.inline-error {
  margin-top: 14px;
}

.message-action-row {
  border-radius: 18px;
  padding: 14px;
  background: rgba(16, 33, 63, 0.04);
  display: grid;
  gap: 12px;
}

.message-action-controls {
  display: grid;
  gap: 10px;
}

.message-action-controls input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(96, 125, 168, 0.26);
  padding: 12px 14px;
  background: rgba(248, 251, 255, 0.9);
}

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

.compact-actions input {
  flex: 1 1 220px;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(96, 125, 168, 0.26);
  padding: 12px 14px;
  background: rgba(248, 251, 255, 0.9);
}

.compact {
  min-height: 42px;
  padding: 10px 14px;
}

.section-gap {
  margin-top: 16px;
}

.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.session-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border-radius: 20px;
  padding: 16px;
  background: rgba(16, 33, 63, 0.04);
}

.session-row.current {
  background: rgba(0, 87, 216, 0.08);
  outline: 1px solid rgba(0, 87, 216, 0.2);
}

.session-row div {
  display: grid;
  gap: 5px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(242, 246, 252, 0.92);
  border: 1px solid rgba(173, 188, 214, 0.22);
  flex-wrap: wrap;
}

.attachment-chip span {
  color: #4d6280;
}

.media-draft-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.media-draft-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.media-draft-meta strong,
.media-draft-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-image-preview,
.attachment-video-preview {
  width: min(220px, 42vw);
  max-height: 160px;
  border-radius: 18px;
  object-fit: cover;
  background: rgba(16, 33, 63, 0.08);
}

.attachment-video-preview.round {
  width: 132px;
  height: 132px;
  border-radius: 999px;
}

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

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, background-color 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.secondary-button {
  background: rgba(242, 246, 252, 0.96);
  color: #173257;
  border: 1px solid rgba(158, 183, 214, 0.2);
}

.secondary-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.secondary-button.active-control {
  background: rgba(0, 87, 216, 0.12);
  color: #0057d8;
}

.secondary-button.danger {
  color: #a1222c;
  background: rgba(194, 51, 56, 0.1);
}

.primary-button {
  background: linear-gradient(135deg, #0057d8 0%, #1e78ff 100%);
  color: #fff;
  padding: 12px 18px;
  box-shadow: 0 14px 30px rgba(0, 87, 216, 0.18);
}

.emoji-picker-shell {
  box-sizing: border-box;
  max-width: 100%;
  margin-bottom: 10px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(158, 183, 214, 0.2);
}

.emoji-search-field {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 0 12px 10px;
  color: rgba(20, 42, 70, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
}

.emoji-search-field input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(147, 176, 214, 0.28);
  border-radius: 14px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #10243f;
  font: inherit;
  outline: none;
}

.emoji-search-field input:focus {
  border-color: rgba(0, 132, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.12);
}

.emoji-category-tabs {
  display: flex;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  padding: 0 12px 10px;
  scrollbar-width: thin;
}

.emoji-category-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  max-width: 132px;
  min-height: 34px;
  border: 1px solid rgba(147, 176, 214, 0.24);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(0, 87, 216, 0.07);
  color: #16335a;
  cursor: pointer;
}

.emoji-category-tab small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emoji-category-tab.active {
  border-color: rgba(0, 132, 255, 0.44);
  background: rgba(0, 132, 255, 0.16);
  color: #0057d8;
}

.emoji-category-tab small {
  font-size: 0.72rem;
  font-weight: 800;
}

.composer-sticker-tray {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(147, 176, 214, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 255, 0.96));
  box-shadow: 0 16px 36px rgba(22, 47, 85, 0.12);
}

.composer-sticker-grid {
  max-height: 238px;
  overflow: auto;
  padding-right: 2px;
}

.composer-emoji-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  gap: 6px;
  padding: 12px;
  max-height: 260px;
  overflow: auto;
}

.emoji-picker-item {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(0, 87, 216, 0.08);
  font-size: 1.2rem;
  cursor: pointer;
}

.emoji-empty-state {
  grid-column: 1 / -1;
  padding: 18px;
  color: rgba(54, 77, 106, 0.68);
  text-align: center;
  font-weight: 700;
}

@media (max-width: 760px) {
  .emoji-picker-shell {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .emoji-category-tabs {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
  }

  .emoji-category-tab {
    max-width: 96px;
  }

  .emoji-category-tab small {
    max-width: 58px;
  }

  .composer-emoji-grid {
    grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
    max-height: min(34vh, 248px);
  }

  .emoji-picker-item {
    min-height: 36px;
  }
}

.recording-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(194, 51, 56, 0.1);
  color: #a1222c;
}

.recording-chip.video-note {
  background: rgba(0, 87, 216, 0.1);
  color: #0057d8;
}

.attachment-audio-preview,
.message-audio,
.message-video {
  width: min(100%, 320px);
  display: block;
}

.message-media-block {
  display: grid;
  gap: 12px;
}

.message-media-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.message-media-link:focus-visible,
.message-sticker:focus-visible,
.message-media-open:focus-visible {
  outline: 2px solid rgba(34, 139, 230, 0.85);
  outline-offset: 3px;
}

.message-image {
  display: block;
  width: min(100%, 320px);
  border-radius: 18px;
  border: 1px solid rgba(173, 188, 214, 0.24);
}

.message-video-shell {
  display: grid;
  justify-items: start;
  gap: 8px;
}

.message-media-open {
  min-height: 34px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(34, 139, 230, 0.14);
  color: #0b6bcb;
  font-weight: 800;
  cursor: pointer;
}

.message-file-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(230, 240, 255, 0.82);
  color: #12305a;
  text-decoration: none;
}

.auth-inline-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.avatar-badge.large {
  width: 88px;
  height: 88px;
  font-size: 1.6rem;
}

.avatar-badge.xlarge {
  width: 112px;
  height: 112px;
  font-size: 2rem;
}

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

.profile-avatar-editor,
.profile-avatar-actions,
.profile-form {
  display: grid;
  gap: 12px;
}

.profile-avatar-editor {
  justify-items: start;
  margin-bottom: 16px;
}

.profile-form textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(173, 188, 214, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: #173257;
}

.inline-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #0057d8;
  font: inherit;
  cursor: pointer;
}

.status-banner.success {
  background: rgba(29, 139, 93, 0.12);
  color: #0f6a45;
}

.qr-form {
  align-items: center;
}

.qr-panel {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.qr-panel svg {
  border-radius: 24px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 16px 38px rgba(16, 33, 63, 0.08);
}

@media (max-width: 980px) {
  .web-shell {
    padding: 18px;
  }

  .web-hero,
  .dashboard-grid,
  .session-row,
  .action-grid {
    grid-template-columns: 1fr;
  }

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

  .attachment-chip,
  .message-file-link {
    align-items: flex-start;
    flex-direction: column;
  }

  .media-draft-chip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .web-shell {
    padding: 8px 8px calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .web-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .web-header-actions {
    width: 100%;
    justify-content: stretch;
    gap: 10px;
  }

  .hero-copy-block,
  .auth-card,
  .hero-panel,
  .dashboard-card {
    padding: 18px;
    border-radius: 22px;
  }

  .web-main {
    padding-top: 18px;
  }

  .web-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .auth-card-head {
    gap: 12px;
    margin-bottom: 16px;
  }

  .auth-card-summary {
    max-width: none;
    font-size: 0.94rem;
  }

  .composer-box {
    grid-template-columns: 1fr;
  }

  .auth-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    grid-template-columns: none;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .auth-tabs::-webkit-scrollbar {
    display: none;
  }

  .auth-tab {
    flex: 0 0 auto;
    min-width: 132px;
    min-height: 46px;
    padding: 12px 14px;
  }

  .auth-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-inline-actions .inline-link-button,
  .auth-inline-actions .ghost-link {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .composer-side-actions {
    width: 100%;
  }

  .messenger-topbar,
  .room-header,
  .room-item-head,
  .room-item-body,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .messenger-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 7px 8px 7px 12px;
    border-radius: 16px;
    top: 4px;
    margin-bottom: 8px;
  }

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

  .topbar-copy .sidebar-eyebrow {
    display: none;
  }

  .topbar-copy h1 {
    display: block;
    font-size: 1rem;
    line-height: 1.1;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-supporting {
    display: none;
  }

  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: end;
    min-width: 0;
  }

  .topbar-actions .status-pill,
  .topbar-actions .secondary-button.compact {
    min-height: 30px;
  }

  .topbar-actions .status-pill {
    justify-content: center;
    padding-inline: 8px;
    font-size: 0.7rem;
  }

  .topbar-actions .secondary-button.compact {
    width: 34px;
    min-width: 34px;
    padding-inline: 0;
    border-radius: 999px;
    font-size: 0.74rem;
  }

  .topbar-actions .mobile-settings-toggle {
    display: inline-flex;
  }

  .topbar-actions .mobile-settings-toggle.active {
    background: rgba(79, 145, 255, 0.18);
    color: #f6fbff;
  }

  .topbar-actions .rail-toggle {
    display: inline-flex;
  }

  .topbar-actions .topbar-context-action {
    width: 34px;
    min-width: 34px;
    gap: 0;
    padding-inline: 0;
  }

  .topbar-actions .topbar-context-action > span {
    width: 24px;
    height: 24px;
  }

  .topbar-actions .topbar-context-action > strong {
    display: none;
  }

  .sidebar-profile {
    gap: 10px;
    padding: 12px;
  }

  .sidebar-profile h2 {
    font-size: 1rem;
  }

  .sidebar-profile p {
    margin: 0;
  }

  .messenger-sidebar,
  .messenger-room {
    border-radius: 16px;
    padding: 8px;
  }

  .messenger-layout {
    display: block;
  }

  .messenger-layout.mobile-list-visible .messenger-room {
    display: none;
  }

  .messenger-layout.mobile-room-visible .messenger-sidebar {
    display: none;
  }

  .sidebar-appnav,
  .sidebar-profile,
  .sidebar-tabs {
    display: none;
  }

  .sidebar-frame,
  .sidebar-content {
    display: block;
  }

  .sidebar-search {
    margin-top: 0;
  }

  .sidebar-search input {
    min-height: 42px;
    border-radius: 14px;
    font-size: 0.94rem;
  }

  .sidebar-account {
    gap: 10px;
    padding: 7px 9px;
    border-radius: 16px;
  }

  .sidebar-account .avatar-badge {
    width: 42px;
    height: 42px;
    font-size: 0.96rem;
  }

  .sidebar-account-copy strong {
    font-size: 0.86rem;
  }

  .sidebar-account-copy span,
  .sidebar-account-state {
    font-size: 0.68rem;
  }

  .sidebar-account-state {
    gap: 6px;
  }

  .sidebar-account-state-text {
    display: none;
  }

  .rail-section-head h3 {
    font-size: 0.92rem;
    line-height: 1.1;
  }

  .mobile-quick-contacts {
    display: grid;
    gap: 6px;
    margin-top: 6px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(168, 190, 220, 0.18);
  }

  .mobile-quick-contacts-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .mobile-quick-contacts-row::-webkit-scrollbar {
    display: none;
  }

  .mobile-quick-contact-chip {
    display: grid;
    justify-items: center;
    gap: 4px;
    min-width: 66px;
    padding: 6px 4px;
    border-radius: 10px;
    border: 1px solid rgba(168, 190, 220, 0.18);
    background: rgba(243, 248, 255, 0.92);
    color: #244366;
    cursor: pointer;
  }

  .mobile-quick-contact-chip span:last-child {
    max-width: 52px;
    font-size: 0.62rem;
    line-height: 1.15;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .room-header-back {
    display: inline-flex;
  }

  .room-list {
    margin-top: 4px;
    gap: 4px;
  }

  .room-list-item {
    padding: 8px 9px;
    border-radius: 12px;
  }

  .room-item-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 0.88rem;
  }

  .room-item-head strong {
    font-size: 0.84rem;
  }

  .room-item-preview,
  .room-item-time {
    font-size: 0.72rem;
  }

  .messenger-rail {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: min(82vh, calc(100vh - 48px));
    padding: 18px 14px calc(98px + env(safe-area-inset-bottom, 0px));
    border-radius: 24px 24px 0 0;
    transform: translateY(calc(100% + 20px));
    opacity: 0;
    pointer-events: none;
    z-index: 42;
    overflow: auto;
    box-shadow: 0 -18px 48px rgba(8, 12, 18, 0.24);
  }

  .messenger-rail.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .rail-card {
    padding: 16px;
    border-radius: 18px;
  }

  .settings-overview {
    gap: 14px;
  }

  .settings-hero,
  .settings-summary-card,
  .settings-profile-card,
  .settings-contacts-card,
  .settings-device-card,
  .settings-security-card {
    border-radius: 18px;
    padding: 16px;
  }

  .settings-hero {
    gap: 12px;
  }

  .settings-status-row {
    gap: 8px;
    flex-wrap: wrap;
  }

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

  .settings-nav::-webkit-scrollbar {
    display: none;
  }

  .settings-nav-item {
    flex: 0 0 auto;
    min-width: 120px;
  }

  .room-header-actions {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .room-header-actions::-webkit-scrollbar {
    display: none;
  }

  .room-header-actions .secondary-button.compact {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    padding-inline: 11px;
  }

  .mobile-room-topbar {
    padding-block: 7px;
  }

  .mobile-room-topbar .topbar-supporting,
  .mobile-room-topbar .topbar-actions .status-pill,
  .mobile-room-topbar .topbar-actions .secondary-button.compact:not(.rail-toggle):not(.mobile-settings-toggle) {
    display: none;
  }

  .mobile-room-topbar .topbar-copy h1 {
    font-size: 1rem;
  }

  .messenger-layout.mobile-room-visible .room-header {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .messenger-layout.mobile-room-visible .room-header-main {
    gap: 10px;
  }

  .messenger-layout.mobile-room-visible .room-header-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 0.86rem;
  }

  .messenger-layout.mobile-room-visible .room-header-actions {
    width: auto;
    margin-left: 0;
    gap: 6px;
  }

  .messenger-layout.mobile-room-visible .room-header-actions.compact-actions .secondary-button.compact,
  .messenger-layout.mobile-room-visible .room-header-actions.compact-actions .primary-button.compact-primary {
    width: auto;
    min-width: 0;
    padding-inline: 14px;
  }

  .messenger-layout.mobile-room-visible .room-header h2 {
    font-size: 1.18rem;
  }

  .messenger-layout.mobile-room-visible .room-header-status {
    font-size: 0.78rem;
  }

  .empty-state {
    margin: 6px 2px 0;
    font-size: 0.84rem;
    line-height: 1.3;
  }

  .messenger-layout.mobile-list-visible .empty-state,
  .message-timeline > .empty-state {
    padding: 13px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(168, 190, 220, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  }

  .room-header {
    gap: 10px;
    padding-bottom: 10px;
  }

  .room-header-main {
    gap: 10px;
  }

  .room-header-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 0.82rem;
  }

  .room-header h2 {
    font-size: 1.06rem;
    line-height: 1.2;
  }

  .room-header-status {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .message-timeline {
    min-height: calc(100vh - 218px);
    padding: 12px 10px calc(104px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px;
    background:
      radial-gradient(circle at top right, rgba(93, 112, 140, 0.05), transparent 24%),
      linear-gradient(180deg, rgba(26, 31, 39, 0.96), rgba(19, 23, 29, 0.98));
  }

  .message-timeline.workspace-landing {
    min-height: 300px;
    padding: 14px 10px 18px;
    align-content: start;
  }

  .workspace-empty-card {
    width: 100%;
    padding: 18px 16px;
    border-radius: 18px;
    gap: 8px;
  }

  .workspace-empty-card h3 {
    font-size: 1.38rem;
  }

  .message-card {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .messenger-layout.mobile-room-visible .message-timeline {
    min-height: calc(100vh - 196px);
    padding-top: 10px;
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }

  .messenger-layout.mobile-room-visible .message-timeline > .empty-state {
    max-width: 100%;
    margin-top: 2px;
    border-radius: 16px;
  }

  .message-meta {
    gap: 6px;
    font-size: 0.76rem;
  }

  .message-meta.has-toggle {
    margin-bottom: 3px;
  }

  .message-menu-button {
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    font-size: 0.75rem;
  }

  .message-bubble p,
  .message-card p {
    margin: 8px 0;
    line-height: 1.45;
  }

  .composer-box {
    position: sticky;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    gap: 8px;
    padding: 9px;
    border-radius: 18px;
    border: 1px solid rgba(155, 181, 215, 0.18);
    background: rgba(244, 248, 255, 0.94);
    box-shadow: 0 16px 34px rgba(13, 34, 73, 0.12);
    backdrop-filter: blur(14px);
  }

  .messenger-layout.mobile-room-visible .composer-box {
    margin-top: 10px;
    padding: 10px;
  }

  .blocked-chat-notice {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 9px;
    border-radius: 18px;
    padding: 11px;
  }

  .composer-input-wrap input,
  .composer-input-wrap textarea {
    min-height: 58px;
    font-size: 0.94rem;
  }

  .composer-side-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .composer-side-actions::-webkit-scrollbar {
    display: none;
  }

  .composer-side-actions .secondary-button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    padding-inline: 12px;
  }

  .attachment-chip {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .attachment-image-preview,
  .attachment-video-preview {
    width: 100%;
    max-height: 220px;
  }

  .attachment-video-preview.round {
    width: 124px;
    height: 124px;
  }

  .messenger-layout.mobile-room-visible .stories-strip {
    display: none;
  }

  .room-lifecycle-confirm-backdrop {
    align-items: end;
    place-items: end center;
    padding: 14px 10px calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .media-viewer-backdrop {
    align-items: end;
    padding: 8px 8px calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .media-viewer {
    width: 100%;
    max-height: calc(100vh - 98px);
    padding: 14px;
    border-radius: 22px;
    overflow: auto;
  }

  .media-viewer-head {
    display: grid;
    gap: 10px;
  }

  .media-viewer-stage {
    min-height: 220px;
    border-radius: 18px;
  }

  .media-viewer-strip {
    padding-bottom: 6px;
  }

  .media-viewer-thumb {
    width: 64px;
    height: 52px;
    border-radius: 12px;
  }

  .room-lifecycle-confirm {
    width: 100%;
    padding: 18px;
    border-radius: 24px;
  }

  .room-lifecycle-confirm .compact-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .compact-actions:not(.topbar-actions) .secondary-button,
  .compact-actions:not(.topbar-actions) .primary-button,
  .primary-button {
    width: 100%;
    justify-content: center;
  }

  .web-header-actions > * {
    flex: 1 1 calc(50% - 5px);
    justify-content: center;
    text-align: center;
  }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding-inline: 5px;
    padding-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    border-radius: 20px;
    background: rgba(18, 26, 39, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: 0 -12px 36px rgba(8, 12, 18, 0.22);
    overflow: hidden;
  }

  .mobile-bottom-nav-item {
    min-width: 0;
    min-height: 48px;
    padding: 5px 0 6px;
    border-radius: 14px;
  }

  .mobile-bottom-nav-glyph {
    font-size: 0.96rem;
  }

  .mobile-bottom-nav-label {
    font-size: clamp(0.5rem, 2.25vw, 0.58rem);
    line-height: 1.1;
  }
}

/* Step 1.208: premium messenger shell polish. Keep this as a focused
   override layer until the broader design-system extraction is complete. */
body {
  background:
    radial-gradient(circle at 12% -10%, rgba(56, 127, 255, 0.2), transparent 30%),
    radial-gradient(circle at 86% 8%, rgba(34, 211, 238, 0.14), transparent 28%),
    linear-gradient(135deg, #eef5ff 0%, #dfeafa 46%, #f6f9ff 100%);
}

.web-shell {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.42), transparent 32%),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.7), transparent 36%);
}

.messenger-topbar,
.messenger-sidebar,
.messenger-room,
.messenger-rail {
  border: 1px solid rgba(132, 154, 190, 0.24);
  box-shadow: 0 28px 76px rgba(19, 34, 58, 0.18);
}

.messenger-topbar {
  background:
    linear-gradient(135deg, rgba(18, 27, 42, 0.96), rgba(26, 42, 66, 0.96)),
    radial-gradient(circle at 12% 0%, rgba(79, 145, 255, 0.18), transparent 36%);
}

.messenger-sidebar {
  background:
    linear-gradient(180deg, rgba(18, 26, 39, 0.98), rgba(12, 18, 29, 0.98)),
    radial-gradient(circle at top left, rgba(80, 154, 255, 0.16), transparent 30%);
}

.sidebar-appnav,
.sidebar-account,
.room-list-item {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.room-list-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(160, 181, 214, 0.1);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.room-list-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(125, 197, 255, 0.22);
}

.room-list-item.active {
  background:
    linear-gradient(135deg, rgba(45, 146, 255, 0.28), rgba(73, 194, 255, 0.16)),
    rgba(255, 255, 255, 0.08);
  border-color: rgba(114, 202, 255, 0.34);
  box-shadow: 0 14px 32px rgba(20, 111, 210, 0.2);
}

.messenger-room {
  background:
    linear-gradient(180deg, rgba(249, 252, 255, 0.92), rgba(232, 240, 252, 0.9)),
    radial-gradient(circle at 100% 0%, rgba(57, 132, 255, 0.08), transparent 30%);
}

.message-timeline {
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 88% 0%, rgba(78, 151, 255, 0.14), transparent 28%),
    radial-gradient(circle at 8% 100%, rgba(49, 214, 190, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(20, 26, 36, 0.98), rgba(13, 18, 27, 0.99));
}

.message-card {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(217, 229, 247, 0.12);
  box-shadow: 0 12px 28px rgba(3, 8, 18, 0.16);
}

.message-card.self {
  background:
    linear-gradient(135deg, rgba(34, 139, 230, 0.95), rgba(35, 195, 174, 0.78));
  border-color: rgba(170, 230, 255, 0.28);
}

.composer-box {
  padding: 12px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(155, 181, 215, 0.24);
  box-shadow: 0 18px 46px rgba(29, 52, 86, 0.14);
  backdrop-filter: blur(16px);
}

.composer-box input,
.composer-box textarea,
.sidebar-search input {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(127, 153, 190, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.primary-button {
  background: linear-gradient(135deg, #0f74ff 0%, #21c7b8 100%);
  box-shadow: 0 16px 34px rgba(15, 116, 255, 0.24);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(132, 154, 190, 0.26);
}

@media (max-width: 640px) {
  body {
    background:
      radial-gradient(circle at 50% -8%, rgba(56, 127, 255, 0.22), transparent 38%),
      linear-gradient(180deg, #eef5ff 0%, #dbe7f8 100%);
  }

  .messenger-sidebar,
  .messenger-room {
    border-radius: 22px;
  }

  .message-timeline {
    border-radius: 22px;
  }

  .mobile-bottom-nav {
    border: 1px solid rgba(139, 165, 202, 0.26);
    background:
      linear-gradient(135deg, rgba(14, 23, 38, 0.94), rgba(23, 35, 53, 0.94));
    box-shadow: 0 -18px 44px rgba(8, 12, 18, 0.24);
  }

  .mobile-bottom-nav-item.active {
    background: linear-gradient(135deg, rgba(37, 130, 255, 0.26), rgba(36, 205, 185, 0.18));
    color: #f7fbff;
  }
}

/* Step 1.213: Telegram-like web polish after removing phone auth from web entry. */
.web-hero {
  align-items: stretch;
}

.hero-copy-block,
.auth-card {
  border: 1px solid rgba(132, 154, 190, 0.22);
  box-shadow: 0 30px 90px rgba(19, 34, 58, 0.16);
}

.auth-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(50, 144, 255, 0.1), transparent 30%),
    rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(22px);
}

.auth-tabs {
  background: rgba(231, 239, 251, 0.74);
  border: 1px solid rgba(143, 166, 201, 0.2);
  border-radius: 18px;
  padding: 5px;
}

.auth-tab {
  border-radius: 14px;
}

.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #1687ff 0%, #27b6d8 100%);
  box-shadow: 0 12px 28px rgba(22, 135, 255, 0.26);
}

.auth-form label input,
.auth-form label textarea {
  border-radius: 16px;
}

.messenger-room {
  background:
    radial-gradient(circle at 18% 0%, rgba(61, 151, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(229, 239, 251, 0.96));
}

.message-timeline {
  border: 1px solid rgba(157, 180, 213, 0.2);
  background:
    radial-gradient(circle at 16px 16px, rgba(34, 132, 232, 0.08) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, #eef6ff 0%, #dceaf9 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.message-card {
  color: #11243a;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(155, 180, 211, 0.24);
  border-radius: 20px 20px 20px 7px;
  box-shadow: 0 10px 26px rgba(35, 69, 109, 0.1);
}

.message-card.self {
  color: #09233c;
  background:
    linear-gradient(135deg, rgba(213, 237, 255, 0.98), rgba(193, 245, 232, 0.96));
  border-color: rgba(74, 168, 226, 0.2);
  border-radius: 20px 20px 7px 20px;
  box-shadow: 0 12px 28px rgba(35, 133, 203, 0.15);
}

.message-card .message-bubble,
.message-card .message-bubble p {
  color: inherit;
}

.dialog-room-item,
.dialog-room-item *,
.telegram-person-card,
.telegram-person-card *,
.telegram-chat-info-card,
.telegram-chat-info-card *,
.room-header,
.room-header * {
  min-width: 0;
}

.dialog-room-title,
.dialog-room-preview,
.telegram-person-main strong,
.telegram-person-main span,
.telegram-chat-info-lines,
.room-title,
.room-subtitle {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-card .message-meta,
.message-card .message-actions,
.message-card .message-reactions {
  color: rgba(34, 55, 82, 0.72);
}

.message-card .message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 7px;
  min-height: 18px;
  font-size: 0.74rem;
  line-height: 1.1;
  white-space: nowrap;
}

.message-card .message-meta strong {
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-card .message-meta .message-menu-button {
  flex: 0 0 auto;
}

.read-receipt-indicator {
  flex: 0 0 auto;
  color: rgba(68, 98, 135, 0.62);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.read-receipt-indicator.read {
  color: #1687ff;
  text-shadow: 0 0 14px rgba(22, 135, 255, 0.22);
}

.room-list-item {
  border-radius: 20px;
}

.room-item-avatar,
.room-header-avatar {
  background: linear-gradient(135deg, #1687ff, #28c7be);
  color: #fff;
}

.room-header .sidebar-eyebrow {
  color: #5e7598;
}

.room-header h2 {
  color: #12305a;
}

.room-header-status {
  color: #6680a2;
}

.composer-box {
  border-radius: 22px;
}

@media (max-width: 640px) {
  .web-hero {
    gap: 18px;
  }

  .hero-copy-block {
    border-radius: 24px;
  }

  .auth-card {
    border-radius: 24px;
  }

  .message-card {
    max-width: min(86%, 360px);
  }

  .messenger-layout.mobile-room-visible .message-timeline {
    background:
      radial-gradient(circle at 14px 14px, rgba(34, 132, 232, 0.09) 0 1px, transparent 1px 20px),
      linear-gradient(180deg, #f3f8ff 0%, #dceaf9 100%);
  }
}

/* Step 1.216: make creation flows first-class and mobile-safe. */
.space-create-card {
  display: grid;
  gap: 12px;
  margin: 10px 0 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(82, 151, 232, 0.18);
  background:
    radial-gradient(circle at 100% 0%, rgba(39, 182, 216, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(237, 247, 255, 0.9));
  box-shadow: 0 16px 38px rgba(23, 68, 116, 0.1);
}

.space-create-card h3 {
  margin: 0;
  color: #12305a;
  font-size: 1rem;
  line-height: 1.15;
}

.space-create-card p {
  margin: 5px 0 0;
  color: #607997;
  font-size: 0.78rem;
  line-height: 1.35;
}

.space-create-form,
.space-create-actions {
  display: grid;
  gap: 8px;
}

.space-create-form input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(127, 158, 198, 0.22);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.92);
  color: #12305a;
  font: inherit;
}

.space-edit-panel {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(82, 151, 232, 0.16);
  background: linear-gradient(180deg, rgba(245, 250, 255, 0.96), rgba(255, 255, 255, 0.92));
}

.space-edit-panel input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(127, 158, 198, 0.22);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.96);
  color: #12305a;
  font: inherit;
}

.space-admin-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(19, 54, 93, 0.12);
}

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

.space-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(19, 54, 93, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.space-member-row.banned {
  border-color: rgba(180, 30, 60, 0.22);
  background: rgba(255, 238, 242, 0.82);
}

.space-member-avatar {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #35a9ff, #17c6b0);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 18px rgba(21, 122, 202, 0.18);
}

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

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

.space-member-row strong {
  color: #0c2340;
  font-size: 0.92rem;
}

.space-member-row span {
  margin-top: 3px;
  color: #6d7c91;
  font-size: 0.78rem;
}

.space-member-actions {
  justify-content: flex-end;
}

.space-member-actions .secondary-button.compact {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
}

body .messenger-shell.telegram-desktop .space-member-row {
  border-color: var(--asya-td-border, rgba(145, 168, 197, 0.12));
  background: rgba(35, 48, 61, 0.72);
}

body .messenger-shell.telegram-desktop .space-member-row.banned {
  border-color: rgba(240, 89, 112, 0.32);
  background: rgba(91, 43, 55, 0.62);
}

body .messenger-shell.telegram-desktop .space-member-avatar {
  background: linear-gradient(135deg, #2ea6ff, #31d3c5);
  box-shadow: none;
}

body .messenger-shell.telegram-desktop .space-member-row strong {
  color: var(--asya-td-text, #f7fbff);
}

body .messenger-shell.telegram-desktop .space-member-row span {
  color: var(--asya-td-muted, #9caabd);
}

body .messenger-shell.telegram-desktop .space-member-actions .secondary-button.compact {
  border-color: rgba(112, 139, 166, 0.25);
  background: rgba(23, 34, 45, 0.78);
  color: var(--asya-td-text, #f7fbff);
}

body .messenger-shell.telegram-desktop .space-member-actions .secondary-button.compact.danger {
  border-color: rgba(240, 89, 112, 0.4);
  background: rgba(120, 48, 64, 0.35);
  color: #ff9aac;
}

@media (min-width: 901px) {
  body .messenger-layout .space-admin-panel .rail-section-head h3 {
    color: #f5f8fb;
  }

  body .messenger-layout .space-member-row {
    grid-template-columns: 38px minmax(0, 1fr) minmax(120px, auto);
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    border-color: rgba(145, 168, 197, 0.14);
    background: rgba(35, 48, 61, 0.72);
  }

  body .messenger-layout .space-member-row.banned {
    border-color: rgba(240, 89, 112, 0.32);
    background: rgba(91, 43, 55, 0.62);
  }

  body .messenger-layout .space-member-avatar {
    display: grid;
    background: linear-gradient(135deg, #2ea6ff, #31d3c5);
    box-shadow: none;
  }

  body .messenger-layout .space-member-row strong {
    color: #f7fbff;
  }

  body .messenger-layout .space-member-row span {
    color: #9caabd;
  }

  body .messenger-layout .space-member-actions .secondary-button.compact {
    border-color: rgba(112, 139, 166, 0.25);
    background: rgba(23, 34, 45, 0.78);
    color: #f7fbff;
  }

  body .messenger-layout .space-member-actions .secondary-button.compact.danger {
    border-color: rgba(240, 89, 112, 0.4);
    background: rgba(120, 48, 64, 0.35);
    color: #ff9aac;
  }
}

  .space-create-form .primary-button,
  .space-create-actions .primary-button,
  .space-create-actions .secondary-button {
    min-height: 44px;
    min-width: 0;
    width: 100%;
    justify-content: center;
  white-space: normal;
  text-align: center;
}

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

.space-create-people::-webkit-scrollbar {
  display: none;
}

.secret-create-card {
  border-color: rgba(45, 197, 164, 0.24);
  background:
    radial-gradient(circle at 0% 0%, rgba(45, 197, 164, 0.14), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 250, 246, 0.9));
}

@media (max-width: 760px) {
  .space-create-card {
    margin: 8px 0 10px;
    padding: 12px;
    border-radius: 18px;
  }

  .space-create-card h3 {
    font-size: 0.92rem;
  }

  .space-create-card p {
    font-size: 0.72rem;
  }

  .space-create-form input {
    min-height: 42px;
    font-size: 0.86rem;
  }

  .compact-actions:not(.topbar-actions) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .compact-actions:not(.topbar-actions) .secondary-button,
  .compact-actions:not(.topbar-actions) .primary-button,
  .compact-actions:not(.topbar-actions) .primary-button.compact-primary {
    flex: 1 1 132px;
    min-width: 0;
    min-height: 42px;
    padding-inline: 10px;
    white-space: normal;
    text-align: center;
    line-height: 1.15;
  }

  .topbar-actions .secondary-button.compact,
  .topbar-actions .primary-button.compact-primary,
  .topbar-actions .rail-toggle,
  .topbar-actions .mobile-settings-toggle {
    min-width: 40px;
    min-height: 40px;
    padding-inline: 10px;
    justify-content: center;
  }

  .topbar-actions .topbar-context-action {
    width: 40px;
    padding-inline: 0;
  }

  .topbar-actions .topbar-context-action > strong {
    display: none;
  }

  .mobile-bottom-nav {
    grid-template-columns: repeat(5, minmax(58px, 1fr));
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .mobile-bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-bottom-nav-item {
    min-width: 58px;
    min-height: 50px;
  }

  .mobile-bottom-nav-label {
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

/* Step 1.218: Telegram-like people search and account polish. */
.contacts-workspace {
  display: grid;
  gap: 14px;
  width: min(760px, 100%);
  margin: 0 auto;
}

.contacts-search-panel,
.telegram-person-card,
.contacts-section-title {
  border: 1px solid rgba(162, 181, 207, 0.18);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 36px rgba(13, 31, 61, 0.07);
}

.contacts-search-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
}

.contacts-search-copy h3 {
  margin: 3px 0 4px;
  color: #132c4d;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
}

.contacts-search-copy p {
  margin: 0;
  color: #637894;
}

.telegram-search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(128, 151, 183, 0.26);
  background: rgba(242, 247, 253, 0.92);
}

.telegram-search-field span {
  color: #6f86a4;
  font-size: 1.1rem;
}

.telegram-search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #172f52;
  font: inherit;
}

.contact-results-list {
  display: grid;
  gap: 10px;
}

.contacts-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 18px;
  color: #19365d;
}

.contacts-section-title span {
  min-width: 34px;
  padding: 5px 9px;
  border-radius: 999px;
  text-align: center;
  color: #1f4f88;
  background: rgba(69, 166, 230, 0.14);
}

.telegram-person-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 22px;
}

.telegram-person-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.telegram-person-main strong,
.telegram-person-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-person-main strong {
  color: #102947;
}

.telegram-person-main small {
  margin-top: 2px;
  color: #71839b;
}

.person-profile-line {
  display: block;
  margin-top: 4px;
  max-width: 100%;
  overflow: hidden;
  color: #53667d;
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-person-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.telegram-person-badges span {
  border-radius: 999px;
  background: rgba(45, 155, 240, 0.12);
  color: #1368aa;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
}

.telegram-person-badges span.blocked {
  background: rgba(218, 63, 94, 0.12);
  color: #b82749;
}

.presence-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #b8c4d2;
}

.presence-dot.online {
  background: #2bc27e;
  box-shadow: 0 0 0 4px rgba(43, 194, 126, 0.14);
}

.telegram-person-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
}

.telegram-person-card.saved {
  grid-template-columns: minmax(0, 1fr) auto;
}

.telegram-person-card.saved .telegram-person-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.telegram-person-menu {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(225, 235, 249, 0.8);
  color: #49627f;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 900;
}

.telegram-person-menu.active {
  color: #0f6fd5;
  background: rgba(46, 139, 230, 0.16);
}

.telegram-person-actions .secondary-button,
.telegram-person-actions .primary-button {
  min-width: max-content;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
}

.settings-hero {
  overflow: hidden;
}

.settings-status-row .inline-pill {
  color: #315b8d;
  background: rgba(73, 155, 223, 0.13);
}

.settings-device-list .session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
}

.settings-device-list .session-item > div,
.settings-device-list .session-item strong,
.settings-device-list .session-item span {
  min-width: 0;
}

.settings-device-list .session-item > span {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .messenger-layout {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  .message-timeline {
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  }

  .contacts-workspace {
    gap: 10px;
  }

  .contacts-search-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .telegram-search-field {
    min-height: 46px;
    border-radius: 16px;
  }

  .telegram-person-card {
    gap: 8px;
    padding: 12px;
    border-radius: 20px;
  }

  .telegram-person-actions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .telegram-person-actions::-webkit-scrollbar {
    display: none;
  }

  .telegram-person-actions .secondary-button,
  .telegram-person-actions .primary-button {
    flex: 0 0 auto;
    width: auto;
  }

  .settings-device-list .session-item {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

/* Step 1.228: Telegram-shaped messenger polish. Keep the runtime logic, replace card clutter with list-first chrome. */
.messenger-layout {
  color: #eef5ff;
}

.sidebar-search input {
  min-height: 56px;
  border: 0;
  border-radius: 28px;
  background: #263241;
  color: #f2f7ff;
  font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(148, 170, 201, 0.08);
}

.sidebar-search input::placeholder,
.telegram-search-field input::placeholder,
.composer-input-wrap textarea::placeholder {
  color: #8d9bad;
}

.room-list-item {
  min-height: 72px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  box-shadow: none;
}

.room-list-item:hover,
.room-list-item.active {
  background: rgba(45, 61, 79, 0.86);
}

.room-list-item strong {
  color: #f6f9ff;
  font-size: 1rem;
  font-weight: 750;
}

.room-list-item span,
.room-item-preview,
.room-item-meta {
  color: #8f9dad;
}

.room-item-avatar,
.avatar-badge {
  background: linear-gradient(145deg, #36c5b6, #2c8df1);
  color: #fff;
  font-weight: 800;
}

.telegram-quick-contact-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  border: 0;
  border-radius: 18px;
  padding: 9px 10px;
  background: transparent;
  color: #edf5ff;
  text-align: left;
  cursor: pointer;
}

.telegram-quick-contact-row:hover {
  background: rgba(45, 61, 79, 0.86);
}

.telegram-quick-contact-row:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.telegram-quick-contact-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.telegram-quick-contact-copy strong,
.telegram-quick-contact-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-quick-contact-copy strong {
  color: #f7fbff;
  font-size: 1rem;
  font-weight: 760;
}

.telegram-quick-contact-copy small {
  color: #93a2b5;
  font-size: 0.86rem;
}

.quick-contact-chip,
.mobile-quick-contact-chip {
  display: none;
}

.contacts-workspace {
  width: 100%;
  margin: 0;
  color: #eef5ff;
}

.contacts-search-panel,
.contacts-section-title,
.telegram-person-card {
  border: 0;
  background: #172331;
  box-shadow: none;
}

.contacts-search-copy h3,
.contacts-section-title,
.telegram-person-main strong {
  color: #f7fbff;
}

.contacts-search-copy p,
.telegram-person-main small,
.person-profile-line {
  color: #95a3b5;
}

.telegram-search-field {
  border: 0;
  background: #263241;
  box-shadow: inset 0 0 0 1px rgba(148, 170, 201, 0.08);
}

.telegram-search-field input {
  color: #f7fbff;
}

.telegram-person-card {
  min-height: 72px;
  border-radius: 20px;
}

.telegram-person-card.saved {
  background: transparent;
}

.telegram-person-card.saved:hover,
.telegram-person-card.saved.actions-open {
  background: #1d2a38;
}

.telegram-person-menu {
  background: #263747;
  color: #dceafe;
}

.telegram-person-actions {
  grid-column: 1 / -1;
}

.telegram-chat-info-card {
  gap: 18px;
  padding: 4px 0 0;
}

.telegram-chat-info-head h3 {
  margin: 0;
  color: #f7fbff;
  font-size: 1.1rem;
}

.telegram-chat-info-head p {
  margin: 4px 0 0;
  color: #91a0b3;
}

.telegram-chat-info-lines {
  display: grid;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(15, 24, 34, 0.52);
}

.telegram-chat-info-lines > div {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-top: 1px solid rgba(137, 157, 184, 0.12);
}

.telegram-chat-info-lines > div:first-child {
  border-top: 0;
}

.telegram-chat-info-lines strong {
  color: #f3f8ff;
  font-size: 0.98rem;
  font-weight: 650;
}

.telegram-chat-info-lines span {
  color: #8999ad;
  font-size: 0.78rem;
}

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

.telegram-chat-info-actions .secondary-button.compact {
  min-height: 42px;
  border-radius: 14px;
  background: #263747;
  color: #eaf4ff;
}

.telegram-chat-info-actions .secondary-button.compact.danger {
  background: rgba(170, 56, 78, 0.2);
  color: #ff8da3;
}

.message-timeline {
  background:
    radial-gradient(circle at 20% 15%, rgba(61, 88, 119, 0.15), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,0.025) 25%, transparent 25%) 0 0 / 32px 32px,
    linear-gradient(180deg, #101a25, #0e1721);
}

.message-card {
  max-width: min(72%, 680px);
  border-radius: 20px 20px 20px 6px;
  background: #223140;
  box-shadow: none;
}

.message-card.self {
  margin-left: auto;
  border-radius: 20px 20px 6px 20px;
  background: linear-gradient(135deg, #2d8cff, #7a4fe8);
}

.composer-box {
  border-radius: 26px;
  background: rgba(18, 29, 41, 0.96);
  border: 1px solid rgba(137, 157, 184, 0.14);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
}

.composer-input-wrap textarea {
  min-height: 54px;
  border: 0;
  border-radius: 24px;
  background: #1f2d3b;
  color: #f7fbff;
}

@media (max-width: 760px) {
  .messenger-topbar {
    border: 0;
    border-radius: 0;
    background: #111b26;
    box-shadow: none;
  }

  .topbar-copy .sidebar-eyebrow,
  .topbar-supporting,
  .topbar-actions .status-pill,
  .topbar-actions .secondary-button.compact:not(.topbar-context-action):not(.mobile-settings-toggle) {
    display: none;
  }

  .topbar-copy h1 {
    color: #f7fbff;
    font-size: clamp(2rem, 9vw, 2.85rem);
    line-height: 1.04;
  }

  .messenger-layout {
    width: 100%;
    margin: 0;
    background: #111b26;
  }

  .messenger-sidebar,
  .messenger-room,
  .messenger-rail {
    border: 0;
    border-radius: 0;
    background: #111b26;
    box-shadow: none;
  }

  .mobile-quick-contacts {
    display: none;
  }

  .sidebar-search input {
    min-height: 62px;
    padding: 0 22px;
    border-radius: 30px;
    font-size: 1.08rem;
  }

  .room-list-item,
  .telegram-person-card {
    min-height: 78px;
    padding: 10px 6px;
  }

  .room-list-item strong,
  .telegram-person-main strong {
    font-size: 1.08rem;
  }

  .room-item-avatar {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    font-size: 1.08rem;
  }

  .contacts-search-panel,
  .contacts-section-title {
    background: transparent;
    padding-inline: 4px;
  }

  .contacts-search-copy {
    display: none;
  }

  .telegram-search-field {
    min-height: 62px;
    border-radius: 30px;
  }

  .message-card {
    max-width: 84%;
    padding: 10px 12px;
  }

  .composer-box {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 28px;
  }

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

/* Step 1.229: global Telegram card reset. Cards become list sections, not floating promo blocks. */
.rail-card,
.entity-card,
.contact-card,
.workspace-empty-card,
.settings-hero,
.settings-summary-card,
.settings-profile-card,
.settings-contacts-card,
.settings-device-card,
.settings-security-card,
.space-create-card,
.story-viewers-card,
.call-summary-card,
.call-history-item,
.active-call-panel,
.secret-chat-banner,
.secret-chat-workspace,
.secret-create-card,
.floating-call-workspace,
.global-call-history-item,
.room-lifecycle-confirm,
.media-draft-chip,
.recording-chip,
.contacts-search-panel,
.contacts-section-title,
.telegram-person-card {
  border: 0;
  background: #172331;
  box-shadow: none;
  backdrop-filter: none;
}

.rail-card,
.workspace-empty-card,
.settings-hero,
.settings-summary-card,
.settings-profile-card,
.settings-contacts-card,
.settings-device-card,
.settings-security-card,
.space-create-card,
.story-viewers-card,
.secret-chat-banner {
  border-radius: 24px;
  padding: 18px;
}

.settings-overview,
.contact-stack,
.settings-contact-section,
.settings-shortcuts,
.profile-form,
.settings-device-list,
.call-history-list,
.global-call-history-list {
  display: grid;
  gap: 8px;
}

.settings-nav,
.story-filter-tabs,
.call-filter-tabs,
.auth-tabs {
  border: 0;
  border-radius: 24px;
  background: #1d2a38;
  box-shadow: inset 0 0 0 1px rgba(145, 168, 197, 0.08);
}

.settings-nav-item,
.story-filter-tab,
.auth-tab {
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #9aa8ba;
}

.settings-nav-item:hover,
.settings-nav-item.active,
.story-filter-tab.active,
.auth-tab.active {
  background: #263747;
  color: #39a9ff;
}

.settings-device-list .session-item,
.settings-summary-card div,
.contact-card,
.call-history-item,
.global-call-history-item,
.story-viewer-row {
  min-height: 64px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
}

.settings-device-list .session-item:hover,
.contact-card:hover,
.call-history-item:hover,
.global-call-history-item:hover,
.story-viewer-row:hover {
  background: #1d2a38;
}

.settings-section-head h3,
.settings-hero-copy h3,
.workspace-empty-card h3,
.space-create-card h3,
.rail-card h3,
.entity-card-head h3,
.contact-card-head strong,
.call-history-item strong,
.global-call-history-item strong,
.settings-device-list .session-item strong,
.settings-summary-card strong,
.profile-grid dd,
.profile-grid strong {
  color: #f7fbff;
}

.settings-section-head p,
.settings-hero-copy p,
.workspace-empty-card p,
.space-create-card p,
.entity-card-head p,
.contact-card-head p,
.contact-card-meta,
.call-history-item span,
.global-call-history-item span,
.settings-device-list .session-item span,
.settings-summary-card span,
.profile-grid dt,
.runtime-note {
  color: #8f9dad;
}

.profile-form input,
.profile-form textarea,
.space-create-form input,
.story-composer-field select,
.story-caption-input,
.message-action-controls input,
.auth-form input,
.auth-form textarea {
  border: 0;
  border-radius: 18px;
  background: #263241;
  color: #f7fbff;
  box-shadow: inset 0 0 0 1px rgba(148, 170, 201, 0.08);
}

.secondary-button,
.primary-button,
.inline-link-button,
.ghost-link {
  border: 0;
  border-radius: 18px;
  box-shadow: none;
}

.secondary-button {
  background: #263747;
  color: #eaf4ff;
}

.primary-button {
  background: #2a9df4;
  color: #fff;
}

.secondary-button.danger {
  background: rgba(176, 60, 83, 0.2);
  color: #ff8fa7;
}

.sidebar-appnav,
.sidebar-account,
.sidebar-tabs,
.sidebar-profile {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar-navicon,
.mobile-bottom-nav-item {
  border-radius: 22px;
}

.mobile-bottom-nav {
  border: 0;
  background: rgba(24, 36, 49, 0.94);
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.mobile-bottom-nav-item.active {
  background: #203a50;
  color: #2aa7ff;
}

@media (max-width: 760px) {
  .topbar-actions .secondary-button.compact:not(.topbar-context-action):not(.mobile-settings-toggle) {
    display: none;
  }

  .topbar-actions .topbar-context-action,
  .topbar-actions .mobile-settings-toggle {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 26px;
    background: transparent;
    color: #eef6ff;
    font-size: 1.55rem;
  }

  .topbar-actions .topbar-context-action > strong {
    display: none;
  }

  .messenger-sidebar {
    padding: 18px 18px calc(116px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar-frame {
    display: block;
  }

  .sidebar-appnav,
  .sidebar-account {
    display: none;
  }

  .sidebar-content {
    gap: 16px;
  }

  .room-list {
    gap: 8px;
  }

  .rail-card,
  .workspace-empty-card,
  .settings-hero,
  .settings-summary-card,
  .settings-profile-card,
  .settings-contacts-card,
  .settings-device-card,
  .settings-security-card,
  .space-create-card,
  .story-viewers-card,
  .secret-chat-banner,
  .contacts-search-panel,
  .contacts-section-title,
  .telegram-person-card {
    background: transparent;
    padding: 8px 0;
    border-radius: 0;
  }

  .settings-device-list .session-item,
  .settings-summary-card div,
  .contact-card,
  .call-history-item,
  .global-call-history-item,
  .story-viewer-row {
    border-radius: 18px;
    padding: 10px 8px;
  }

  .settings-nav {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  .settings-profile-card,
  .settings-contacts-card,
  .settings-device-card,
  .settings-security-card {
    display: grid;
    gap: 12px;
  }

  .profile-form {
    gap: 10px;
  }
}

/* Step 1.229 hotfix: beat legacy light workspace rules with mobile-specific selectors. */
body .messenger-layout .messenger-room,
body .messenger-layout .message-timeline,
body .messenger-layout.mobile-list-visible .message-timeline,
body .messenger-layout.mobile-room-visible .message-timeline,
body .message-timeline.workspace-landing,
body .messenger-layout.mobile-list-visible .empty-state,
body .message-timeline > .empty-state {
  border: 0 !important;
  background: #111b26 !important;
  box-shadow: none !important;
}

body .message-timeline,
body .message-timeline.workspace-landing {
  min-height: calc(100vh - 180px);
}

body .empty-state {
  display: block;
  width: auto;
  margin: 8px 0;
  padding: 10px 12px;
  border: 0 !important;
  border-radius: 16px;
  background: #172331 !important;
  color: #8f9dad !important;
  box-shadow: none !important;
}

body .contacts-workspace,
body .contacts-search-panel,
body .contacts-section-title,
body .telegram-person-card {
  background: transparent !important;
  box-shadow: none !important;
}

body .messenger-topbar .topbar-copy h1 {
  color: #f7fbff !important;
  font-size: clamp(2rem, 9vw, 2.85rem) !important;
  line-height: 1.04 !important;
}

body .messenger-topbar {
  border-bottom: 1px solid rgba(145, 168, 197, 0.14) !important;
}

body .contacts-section-title {
  color: #f7fbff !important;
}

html,
body,
#root {
  min-height: 100%;
  background: #111b26 !important;
}

body {
  margin: 0;
  background: #111b26 !important;
}

body .messenger-layout,
body .messenger-layout.mobile-list-visible,
body .messenger-layout.mobile-room-visible,
body .messenger-layout.mobile-list-visible .messenger-sidebar,
body .messenger-layout.mobile-room-visible .messenger-room {
  min-height: calc(100vh - 74px) !important;
  background: #111b26 !important;
}

@media (max-width: 760px) {
  body .messenger-topbar {
    position: sticky !important;
    top: 0;
    z-index: 50;
  }

  body .messenger-layout.mobile-list-visible .messenger-sidebar {
    padding-bottom: calc(124px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Step 1.230: Telegram-like mobile folders, settings tabs and chat chrome. */
.mobile-folder-tabs {
  display: none;
}

@media (max-width: 760px) {
  body .messenger-topbar.mobile-room-topbar {
    display: none !important;
  }

  body .messenger-topbar .topbar-context-action {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: 22px !important;
    background: transparent !important;
    color: #eef6ff !important;
  }

  body .messenger-topbar .topbar-context-action span {
    font-size: 1.35rem;
  }

  .mobile-folder-tabs {
    display: flex;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 2px 14px 8px 0;
    scroll-padding-inline: 14px;
    scrollbar-width: none;
  }

  .mobile-folder-tabs::-webkit-scrollbar {
    display: none;
  }

  .mobile-folder-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    max-width: min(46vw, 168px);
    min-height: 40px;
    border: 0;
    border-radius: 22px;
    padding: 0 15px;
    background: #1a2634;
    color: #94a4b7;
    font: inherit;
    font-weight: 700;
  }

  .mobile-folder-tab span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-folder-tab strong {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    padding: 0 7px;
    background: #738398;
    color: #101923;
    font-size: 0.82rem;
  }

  .mobile-folder-tab.active {
    background: #244a69;
    color: #55b7ff;
  }

  .mobile-folder-tab.active strong {
    background: #55b7ff;
    color: #07111b;
  }

  .folder-picker-panel {
    position: fixed;
    inset: 0;
    z-index: 160;
    display: grid;
    place-items: end center;
    padding: 18px;
    background: rgba(8, 14, 22, 0.56);
    backdrop-filter: blur(14px);
  }

  .folder-picker-card,
  .settings-folders-card,
  .chat-folder-workspace {
    width: min(100%, 520px);
    border: 1px solid rgba(143, 166, 197, 0.16);
    border-radius: 24px;
    padding: 16px;
    background: #172331;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  }

  .folder-picker-card {
    display: grid;
    gap: 14px;
  }

  .folder-picker-list,
  .folder-settings-list {
    display: grid;
    gap: 8px;
  }

  .folder-picker-row,
  .folder-settings-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 17px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.045);
    color: #f7fbff;
    text-align: left;
  }

  .folder-picker-row > span,
  .folder-color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  }

  .folder-picker-row small,
  .folder-settings-row small {
    color: #93a4b8;
  }

  .folder-settings-row > div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .folder-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  /* Step 1.235: make folder contents read like a Telegram list, not cards inside cards. */
  .chat-folder-workspace {
    display: grid;
    gap: 4px;
    padding: 10px 0 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .chat-folder-workspace .contacts-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px 8px;
    background: transparent !important;
  }

  .chat-folder-workspace .contacts-section-title strong {
    color: #f7fbff;
    font-size: 1.02rem;
    letter-spacing: -0.02em;
  }

  .chat-folder-workspace .contacts-section-title span {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    border-radius: 14px;
    background: #25425d;
    color: #55b7ff;
    font-weight: 800;
  }

  .chat-folder-workspace .folder-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 68px;
    padding: 6px 2px;
    border-radius: 0;
    border-bottom: 1px solid rgba(143, 166, 197, 0.1);
    background: transparent !important;
    box-shadow: none !important;
  }

  .chat-folder-workspace .folder-row:last-of-type {
    border-bottom: 0;
  }

  .chat-folder-workspace .folder-row .telegram-person-main {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
  }

  .chat-folder-workspace .folder-row .room-item-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2eb7e8, #1fbfa8);
    box-shadow: none;
  }

  .chat-folder-workspace .folder-row .telegram-person-main > span:last-child {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .chat-folder-workspace .folder-row strong,
  .chat-folder-workspace .folder-row small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-folder-workspace .folder-row strong {
    color: #f7fbff;
    font-size: 1rem;
    letter-spacing: -0.015em;
  }

  .chat-folder-workspace .folder-row small {
    color: #8fa0b5;
    font-size: 0.88rem;
  }

  .chat-folder-workspace .folder-row > .secondary-button.compact {
    min-width: 74px;
    min-height: 38px;
    border-radius: 19px;
    background: #223246;
    color: #e9f4ff;
    font-weight: 700;
  }

  body .mobile-bottom-nav {
    left: 20px;
    right: 20px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    max-width: 640px;
    margin-inline: auto;
    padding: 8px;
    border-radius: 30px;
    background: rgba(25, 39, 53, 0.94) !important;
    box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.34);
  }

  body .mobile-bottom-nav-item {
    min-width: 0 !important;
    min-height: 66px;
    border-radius: 24px;
    color: #eef6ff;
  }

  body .mobile-bottom-nav-item.active {
    background: #203c55 !important;
    color: #2fb1ff !important;
  }

  body .mobile-bottom-nav-glyph {
    font-size: 1.55rem;
    line-height: 1;
  }

  body .mobile-bottom-nav-label {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
  }

  body .messenger-layout.mobile-room-visible {
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
  }

  body .messenger-layout.mobile-room-visible .messenger-room {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100dvh !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body .messenger-layout.mobile-room-visible .room-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
    align-items: center;
    gap: 6px;
    min-height: 72px;
    margin: 0 !important;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(17, 27, 38, 0.98) !important;
    box-shadow: 0 1px 0 rgba(148, 170, 201, 0.12) !important;
  }

  body .messenger-layout.mobile-room-visible .room-header-main {
    grid-column: 2;
    min-width: 0;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
  }

  body .messenger-layout.mobile-room-visible .room-header-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 1rem;
  }

  body .messenger-layout.mobile-room-visible .room-header .sidebar-eyebrow {
    display: none;
  }

  body .messenger-layout.mobile-room-visible .room-header h2 {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    color: #f8fbff !important;
    font-size: 1.05rem !important;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body .messenger-layout.mobile-room-visible .room-header-status {
    overflow: hidden;
    color: #93a4b8 !important;
    font-size: 0.86rem !important;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body .messenger-layout.mobile-room-visible .room-header-actions {
    display: contents !important;
  }

  body .messenger-layout.mobile-room-visible .room-header-actions .secondary-button.compact,
  body .messenger-layout.mobile-room-visible .room-header-actions .primary-button.compact-primary {
    display: inline-grid;
    place-items: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 21px;
    background: transparent !important;
    color: #eef6ff !important;
    font-size: 0;
  }

  body .messenger-layout.mobile-room-visible .room-header-back::before {
    content: "\2190";
    font-size: 1.55rem;
    line-height: 1;
  }

  body .messenger-layout.mobile-room-visible .room-header-back {
    grid-column: 1;
    grid-row: 1;
  }

  body .messenger-layout.mobile-room-visible [data-call-action="start-audio"]::before {
    content: "\260E";
    font-size: 1.24rem;
    line-height: 1;
  }

  body .messenger-layout.mobile-room-visible [data-folder-action="add-current-room"]::before {
    content: "\25A3";
    font-size: 1.12rem;
    line-height: 1;
  }

  body .messenger-layout.mobile-room-visible [data-call-action="start-audio"] {
    grid-column: 3;
    grid-row: 1;
  }

  body .messenger-layout.mobile-room-visible [data-folder-action="add-current-room"] {
    display: none !important;
  }

  body .messenger-layout.mobile-room-visible [data-call-action="start-video"] {
    display: none !important;
  }

  body .messenger-layout.mobile-room-visible .room-header-rail::before {
    content: "\22EE";
    font-size: 1.55rem;
    line-height: 1;
  }

  body .messenger-layout.mobile-room-visible .room-header-rail {
    grid-column: 4;
    grid-row: 1;
  }

  body .messenger-layout.mobile-room-visible .room-overflow-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    z-index: 35;
    display: grid;
    width: min(230px, calc(100vw - 24px));
    gap: 2px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: rgba(32, 45, 60, 0.98);
    box-shadow: 0 18px 42px rgba(2, 8, 23, 0.36);
  }

  body .messenger-layout.mobile-room-visible .room-overflow-item {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #eef6ff;
    font: inherit;
    font-size: 0.96rem;
    font-weight: 750;
    text-align: left;
    padding: 0 12px;
  }

  body .messenger-layout.mobile-room-visible .room-overflow-item.danger {
    color: #ff9aa5;
    background: rgba(255, 88, 105, 0.12);
  }

  body .messenger-layout.mobile-room-visible .room-overflow-item:active {
    background: rgba(56, 189, 248, 0.16);
  }

  body .messenger-layout.mobile-room-visible .message-timeline {
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 12px 10px 10px !important;
    background:
      radial-gradient(circle at 10% 8%, rgba(64, 118, 164, 0.12), transparent 26%),
      #111b26 !important;
  }

  body .message-card {
    border: 0 !important;
    box-shadow: none !important;
  }

  body .message-card.own,
  body .message-card.self {
    border-radius: 20px 20px 6px 20px !important;
    background: transparent !important;
    color: #fff !important;
  }

  body .message-card.own .message-bubble,
  body .message-card.self .message-bubble {
    border: 0 !important;
    border-radius: 20px 20px 6px 20px !important;
    background: linear-gradient(135deg, #2d8cff, #7a4fe8) !important;
    box-shadow: none !important;
  }

  body .message-card:not(.own) {
    border-radius: 20px 20px 20px 6px !important;
    background: #1d2a38 !important;
  }

  body .message-card.own,
  body .message-card.self,
  body .message-card.own .message-bubble,
  body .message-card.self .message-bubble,
  body .message-card.own p,
  body .message-card.self p,
  body .message-card.self span,
  body .message-card.own .message-meta {
    color: #fff !important;
  }

  body .message-card.self .message-meta {
    color: rgba(255, 255, 255, 0.8) !important;
  }

  body .composer-box {
    position: sticky;
    bottom: calc(94px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    align-items: end;
    gap: 6px;
    margin: 0 8px 8px;
    padding: 7px !important;
    border: 1px solid rgba(143, 166, 197, 0.18) !important;
    border-radius: 28px !important;
    background: rgba(25, 38, 52, 0.98) !important;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24) !important;
  }

  body .composer-input-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  body .composer-input-wrap textarea {
    min-height: 48px !important;
    max-height: 148px;
    padding: 13px 14px !important;
    border-radius: 22px !important;
    background: transparent !important;
    color: #f8fbff !important;
    font-size: 1.02rem !important;
  }

  body .composer-side-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: nowrap;
    width: auto;
    max-width: none;
    overflow: visible;
  }

  body .composer-side-actions .secondary-button:not([data-composer-action="attach"]):not([data-composer-action="emoji"]):not([data-composer-action="stickers"]) {
    display: none !important;
  }

  body .composer-side-actions .secondary-button,
  body .composer-box > [data-composer-action="send"] {
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 auto;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 22px !important;
    font-size: 0 !important;
    line-height: 1 !important;
    overflow: hidden;
  }

  body .composer-side-actions [data-composer-action="emoji"]::before {
    content: "\263A";
    color: #d8e7f7;
    font-size: 1.35rem;
  }

  body .composer-side-actions [data-composer-action="stickers"]::before {
    content: "\25A7";
    color: #d8e7f7;
    font-size: 1.2rem;
  }

  body .composer-side-actions [data-composer-action="attach"]::before {
    content: "\1F4CE";
    color: #d8e7f7;
    font-size: 1.2rem;
  }

  body .composer-box > [data-composer-action="send"] {
    background: #2aa7ff !important;
    color: transparent !important;
  }

  body .composer-box > [data-composer-action="send"]::before {
    content: "\27A4";
    color: #fff;
    font-size: 1.25rem;
  }

  body .settings-overview {
    gap: 14px;
    padding-bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  }

  body .settings-hero {
    grid-template-columns: 86px minmax(0, 1fr);
    align-items: center;
    min-height: 112px;
    padding: 14px 4px !important;
    background: transparent !important;
  }

  body .settings-hero .avatar-badge.xlarge {
    width: 82px;
    height: 82px;
    border-radius: 50%;
  }

  body .settings-hero-copy h3 {
    margin: 0;
    color: #f8fbff !important;
    font-size: 1.9rem;
    line-height: 1.05;
  }

  body .settings-status-row {
    display: none;
  }

  body .settings-nav {
    position: static !important;
    display: grid;
    gap: 0;
    padding: 8px 0;
    border-radius: 22px;
    background: #172331 !important;
  }

  body .settings-nav-item {
    justify-content: flex-start;
    min-height: 58px;
    border-radius: 0 !important;
    padding: 0 16px;
    background: transparent !important;
    color: #f4f8ff !important;
    font-size: 1.05rem;
    font-weight: 800;
    text-align: left;
  }

  body .settings-nav-item::before {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-right: 12px;
    border-radius: 11px;
    color: #fff;
    font-size: 1.05rem;
  }

  body .settings-nav-item[data-settings-section="profile"]::before {
    content: "\25CE";
    background: #2aa7ff;
  }

  body .settings-nav-item[data-settings-section="contacts"]::before {
    content: "+";
    background: #34c759;
  }

  body .settings-nav-item[data-settings-section="folders"]::before {
    content: "\25A3";
    background: #2aa7ff;
  }

  body .settings-nav-item[data-settings-section="devices"]::before {
    content: "\25AD";
    background: #36b8d9;
  }

  body .settings-nav-item[data-settings-section="security"]::before {
    content: "\26BF";
    background: #2fbf61;
  }

  body .settings-nav-item.active {
    color: #2fb1ff !important;
  }

  body .settings-summary-card,
  body .settings-profile-card,
  body .settings-contacts-card,
  body .settings-device-card,
  body .settings-security-card,
  body .space-create-card,
  body .secret-chat-banner,
  body .secret-chat-workspace {
    border-radius: 22px !important;
    padding: 14px !important;
    background: #172331 !important;
  }

  body .settings-summary-card div,
  body .settings-device-list .session-item,
  body .contact-card {
    min-height: 58px;
    padding: 10px 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  body .space-create-card {
    gap: 12px;
  }

  body .space-create-form {
    grid-template-columns: 1fr;
  }

  body .secret-chat-workspace .settings-summary-card {
    display: none;
  }

  body .messenger-topbar .mobile-settings-toggle {
    display: inline-grid !important;
    place-items: center;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: 22px !important;
    background: transparent !important;
    color: #eef6ff !important;
    font-size: 1.28rem !important;
  }

  body .messenger-layout.mobile-room-visible .composer-box {
    position: relative !important;
    bottom: auto !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 5px !important;
    width: auto !important;
    margin: 6px 8px calc(86px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body .messenger-layout.mobile-room-visible .composer-side-actions {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    width: auto !important;
    max-width: 124px !important;
    order: 0;
  }

  body .messenger-layout.mobile-room-visible .composer-input-wrap {
    flex: 1 1 96px !important;
    min-width: 0 !important;
    order: 1;
  }

  body .messenger-layout.mobile-room-visible .composer-box > [data-composer-action="send"] {
    flex: 0 0 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    order: 2;
  }

  body .messenger-layout.mobile-room-visible .composer-side-actions .secondary-button {
    flex: 0 0 38px !important;
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
  }

  body .messenger-layout.mobile-room-visible .composer-input-wrap textarea {
    min-height: 42px !important;
    height: 42px !important;
    padding: 10px 12px !important;
    resize: none;
  }

  body .messenger-layout.mobile-room-visible .message-card {
    position: relative;
    align-self: flex-start;
    width: fit-content !important;
    max-width: min(82%, 520px) !important;
    margin: 2px 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body .messenger-layout.mobile-room-visible .message-card.self {
    align-self: flex-end !important;
    background: transparent !important;
  }

  body .messenger-layout.mobile-room-visible .message-card .message-bubble {
    position: relative;
    min-width: 76px;
    padding: 9px 54px 18px 12px !important;
    border: 0 !important;
    border-radius: 18px 18px 18px 5px !important;
    background: #202f3e !important;
    color: #f7fbff !important;
    box-shadow: 0 6px 18px rgba(4, 11, 18, 0.18) !important;
  }

  body .messenger-layout.mobile-room-visible .message-card.self .message-bubble {
    border-radius: 18px 18px 5px 18px !important;
    background: linear-gradient(135deg, #2d8cff 0%, #7a4fe8 100%) !important;
    color: #fff !important;
  }

  body .messenger-layout.mobile-room-visible .message-card .message-bubble p,
  body .messenger-layout.mobile-room-visible .message-card .message-bubble span {
    color: inherit !important;
  }

  body .messenger-layout.mobile-room-visible .message-card .message-meta {
    position: absolute;
    right: 8px;
    bottom: 3px;
    z-index: 2;
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-end;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 3px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(230, 239, 249, 0.72) !important;
    font-size: 0.66rem !important;
    line-height: 1;
  }

  body .messenger-layout.mobile-room-visible .message-card.self .message-meta {
    color: rgba(255, 255, 255, 0.78) !important;
  }

  body .messenger-layout.mobile-room-visible .message-card .message-meta > span:first-of-type {
    max-width: 38px;
    overflow: hidden;
    white-space: nowrap;
  }

  body .messenger-layout.mobile-room-visible .message-card .message-menu-button {
    display: inline-grid !important;
    place-items: center;
    width: 16px !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: currentColor !important;
    font-size: 0.56rem !important;
    letter-spacing: -0.08em !important;
    opacity: 0.7;
  }

  body .messenger-layout.mobile-room-visible .message-card .message-menu-button.active {
    background: rgba(255, 255, 255, 0.16) !important;
    opacity: 1;
  }

  body .messenger-layout.mobile-room-visible .message-card .message-actions {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 8;
    margin: 0 !important;
    padding: 6px !important;
    border-radius: 16px !important;
    background: rgba(24, 36, 49, 0.96) !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28) !important;
  }
}

/* Step 1.237: desktop-only Telegram pass. Keep mobile rules above untouched. */
@media (min-width: 901px) {
  html,
  body,
  #root {
    background:
      radial-gradient(circle at 12% 4%, rgba(62, 156, 255, 0.14), transparent 30%),
      radial-gradient(circle at 88% 10%, rgba(40, 210, 190, 0.10), transparent 26%),
      linear-gradient(180deg, #eef5fd 0%, #dfeaf6 100%) !important;
  }

  body {
    background:
      radial-gradient(circle at 12% 4%, rgba(62, 156, 255, 0.14), transparent 30%),
      radial-gradient(circle at 88% 10%, rgba(40, 210, 190, 0.10), transparent 26%),
      linear-gradient(180deg, #eef5fd 0%, #dfeaf6 100%) !important;
    color: #10243d;
    min-height: 100vh;
    overflow-x: hidden;
  }

  body .messenger-topbar {
    width: min(1880px, calc(100vw - 32px)) !important;
    margin: 0 auto 14px !important;
  }

  body .messenger-header {
    width: min(1880px, calc(100vw - 32px));
    min-height: 88px;
    margin: 0 auto 14px;
    padding: 18px 22px !important;
    border: 1px solid rgba(130, 157, 191, 0.36);
    border-radius: 26px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(232, 243, 255, 0.88)),
      radial-gradient(circle at 0% 0%, rgba(42, 167, 255, 0.16), transparent 34%);
    color: #0f2744;
    box-shadow: 0 22px 60px rgba(50, 80, 120, 0.16) !important;
  }

  body .messenger-header h1,
  body .messenger-header p,
  body .messenger-header span {
    color: #0f2744 !important;
  }

  body .messenger-layout {
    width: min(1880px, calc(100vw - 32px));
    min-height: calc(100vh - 128px);
    grid-template-columns: minmax(360px, 400px) minmax(0, 1fr) 300px;
    gap: 16px;
    background: transparent !important;
  }

  body .messenger-layout.mobile-list-visible,
  body .messenger-layout.mobile-room-visible {
    background: transparent !important;
  }

  body .messenger-layout.desktop-rail-collapsed {
    grid-template-columns: minmax(360px, 400px) minmax(0, 1fr);
  }

  body .messenger-sidebar,
  body .messenger-room,
  body .messenger-rail {
    min-height: calc(100vh - 146px);
    border: 1px solid rgba(127, 153, 188, 0.28);
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(42, 73, 113, 0.16) !important;
  }

  body .messenger-layout .messenger-sidebar,
  body .messenger-layout.mobile-list-visible .messenger-sidebar {
    padding: 14px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 241, 252, 0.92)),
      radial-gradient(circle at 0% 0%, rgba(42, 167, 255, 0.12), transparent 32%) !important;
    box-shadow: 0 24px 70px rgba(42, 73, 113, 0.16) !important;
  }

  body .sidebar-frame {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }

  body .sidebar-appnav {
    background: rgba(222, 235, 249, 0.82);
    border-color: rgba(126, 153, 186, 0.22);
  }

  body .sidebar-content {
    gap: 12px;
  }

  body .sidebar-account,
  body .telegram-quick-contact-row,
  body .room-list-item {
    background: transparent !important;
    color: #10243d !important;
  }

  body .room-list {
    gap: 2px;
    padding-top: 4px;
  }

  body .room-list-item {
    min-height: 68px;
    border: 0 !important;
    border-radius: 18px;
    box-shadow: none !important;
  }

  body .room-list-item:hover,
  body .room-list-item.active {
    background: rgba(42, 167, 255, 0.12) !important;
  }

  body .room-list-item strong,
  body .telegram-quick-contact-copy strong,
  body .room-item-head strong {
    color: #0f2744 !important;
  }

  body .room-list-item span,
  body .room-list-item small,
  body .room-item-preview,
  body .telegram-quick-contact-copy small {
    color: #60758d !important;
  }

  body .telegram-search-field,
  body .sidebar-search,
  body .room-search {
    background: rgba(218, 231, 247, 0.88) !important;
    color: #10243d !important;
  }

  body .messenger-layout .messenger-room,
  body .messenger-layout.mobile-list-visible .messenger-room,
  body .messenger-layout.mobile-room-visible .messenger-room {
    display: grid;
    grid-template-rows: auto minmax(420px, 1fr) auto;
    min-height: calc(100vh - 146px);
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(248, 252, 255, 0.97), rgba(232, 241, 251, 0.96)),
      radial-gradient(circle at 85% 0%, rgba(42, 167, 255, 0.12), transparent 32%) !important;
    box-shadow: 0 24px 70px rgba(42, 73, 113, 0.16) !important;
  }

  body .room-header {
    margin: 0 !important;
    padding: 18px 20px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(127, 153, 188, 0.22) !important;
    border-radius: 0 !important;
    background: rgba(248, 252, 255, 0.92) !important;
    box-shadow: none !important;
  }

  body .room-header h2 {
    color: #0e2a48 !important;
  }

  body .room-header-status,
  body .room-header .sidebar-eyebrow {
    color: #60758d !important;
  }

  body .messenger-layout .message-timeline,
  body .messenger-layout.mobile-list-visible .message-timeline,
  body .messenger-layout.mobile-room-visible .message-timeline,
  body .message-timeline.workspace-landing {
    min-height: 0;
    height: auto !important;
    margin: 0;
    padding: 24px 28px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background:
      linear-gradient(180deg, rgba(246, 250, 255, 0.98), rgba(231, 240, 250, 0.98)),
      radial-gradient(circle at 10% 10%, rgba(42, 167, 255, 0.10), transparent 28%) !important;
    color: #10243d !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78) !important;
  }

  body .messenger-layout .message-timeline:not(.workspace-landing) {
    min-height: 420px !important;
  }

  body .message-card {
    max-width: min(68%, 720px);
    border: 0 !important;
    background: transparent !important;
    color: #10243d !important;
    box-shadow: none !important;
  }

  body .messenger-layout .message-card.self,
  body .messenger-layout .message-card.own {
    border-radius: 20px 20px 6px 20px !important;
    background: linear-gradient(135deg, #dff0ff 0%, #c9e9ff 100%) !important;
    color: #10243d !important;
    box-shadow: 0 16px 36px rgba(39, 76, 118, 0.12) !important;
  }

  body .messenger-layout .message-card .message-bubble {
    padding: 12px 14px !important;
    border: 1px solid rgba(126, 153, 186, 0.24) !important;
    border-radius: 20px 20px 20px 6px !important;
    background: linear-gradient(135deg, #ffffff 0%, #edf6ff 100%) !important;
    color: #10243d !important;
    box-shadow: 0 16px 36px rgba(39, 76, 118, 0.12) !important;
  }

  body .messenger-layout .message-card.self .message-bubble,
  body .messenger-layout .message-card.own .message-bubble {
    border-radius: 20px 20px 6px 20px !important;
    background: linear-gradient(135deg, #dff0ff 0%, #c9e9ff 100%) !important;
    color: #10243d !important;
  }

  body .messenger-layout .message-card .message-bubble p,
  body .messenger-layout .message-card .message-bubble span,
  body .messenger-layout .message-card.self .message-bubble p,
  body .messenger-layout .message-card.self .message-bubble span,
  body .messenger-layout .message-card.own .message-bubble p,
  body .messenger-layout .message-card.own .message-bubble span {
    color: #10243d !important;
  }

  body .message-card .message-meta {
    margin-top: 6px !important;
    color: #60758d !important;
  }

  body .composer-box {
    margin: 0;
    padding: 14px 18px !important;
    border: 0 !important;
    border-top: 1px solid rgba(127, 153, 188, 0.22) !important;
    border-radius: 0 0 28px 28px !important;
    background: rgba(248, 252, 255, 0.96) !important;
    color: #10243d !important;
    box-shadow: none !important;
  }

  body .composer-input-wrap textarea {
    min-height: 52px;
    border: 1px solid rgba(126, 153, 186, 0.22) !important;
    background: #eef6ff !important;
    color: #10243d !important;
  }

  body .composer-input-wrap textarea::placeholder {
    color: #75889d !important;
  }

  body .workspace-empty-stats,
  body .empty-state-card,
  body [data-testid="dialogs-empty-workspace"] {
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(233, 244, 255, 0.92)),
      radial-gradient(circle at 0% 0%, rgba(42, 167, 255, 0.14), transparent 34%) !important;
    color: #10243d !important;
    box-shadow: 0 24px 64px rgba(42, 73, 113, 0.14) !important;
  }

  body [data-testid="dialogs-empty-workspace"] h2,
  body [data-testid="dialogs-empty-workspace"] h3,
  body [data-testid="dialogs-empty-workspace"] strong,
  body [data-testid="dialogs-empty-workspace"] p,
  body [data-testid="dialogs-empty-workspace"] span {
    color: #10243d !important;
  }

  body [data-testid="dialogs-empty-workspace"] .sidebar-eyebrow,
  body [data-testid="dialogs-empty-workspace"] small,
  body .workspace-empty-stats span {
    color: #60758d !important;
  }

  body .empty-state,
  body .room-list-empty {
    border: 1px solid rgba(126, 153, 186, 0.18) !important;
    background: rgba(238, 246, 255, 0.86) !important;
    color: #60758d !important;
  }

  body .sidebar-account strong,
  body .sidebar-account small,
  body .sidebar-account span {
    color: #10243d !important;
  }

  body .sidebar-account small,
  body .sidebar-account span:last-child {
    color: #60758d !important;
  }

  body .messenger-layout .rail-section-head h3,
  body .messenger-layout .rail-section-head strong,
  body .messenger-layout .contacts-section-title strong,
  body .messenger-layout .contacts-section-title {
    color: #10243d !important;
  }

  body .messenger-layout .rail-section-head .ghost-link,
  body .messenger-layout .contacts-section-title span {
    color: #245f9b !important;
  }
}

/* Step 1.238: desktop-only Telegram Desktop parity pass. Mobile rules stay untouched. */
@media (min-width: 901px) {
  :root {
    --asya-td-bg: #0f141a;
    --asya-td-titlebar: #3a4148;
    --asya-td-rail: #17212b;
    --asya-td-list: #202b33;
    --asya-td-list-hover: #27343d;
    --asya-td-selected: #0aa08f;
    --asya-td-room-header: #1d252d;
    --asya-td-room: #11161c;
    --asya-td-bubble: #2c363f;
    --asya-td-bubble-own: #056162;
    --asya-td-text: #f4f7fb;
    --asya-td-muted: #8b9aa7;
    --asya-td-faint: #657482;
    --asya-td-border: #2a343d;
    --asya-td-accent: #35d6c6;
  }

  html,
  body,
  #root {
    width: 100%;
    min-height: 100%;
    background: var(--asya-td-bg) !important;
  }

  body {
    margin: 0;
    overflow: hidden;
    background: var(--asya-td-bg) !important;
    color: var(--asya-td-text);
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    z-index: 0;
    height: 24px;
    background: var(--asya-td-titlebar);
    pointer-events: none;
  }

  body .messenger-topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 8;
    width: 100vw !important;
    height: 24px !important;
    min-height: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--asya-td-titlebar) !important;
    box-shadow: none !important;
  }

  body .messenger-topbar .topbar-copy,
  body .messenger-topbar .topbar-actions,
  body .messenger-topbar .sidebar-eyebrow {
    display: none !important;
  }

  body .messenger-layout {
    position: relative;
    z-index: 1;
    width: 100vw !important;
    height: calc(100vh - 24px);
    min-height: calc(100vh - 24px);
    margin: 24px 0 0 !important;
    display: grid !important;
    grid-template-columns: 504px minmax(0, 1fr) 320px;
    gap: 0 !important;
    overflow: hidden;
    background: var(--asya-td-bg) !important;
  }

  body .messenger-layout.desktop-rail-collapsed {
    grid-template-columns: 504px minmax(0, 1fr);
  }

  body .messenger-sidebar,
  body .messenger-room,
  body .messenger-rail {
    min-height: calc(100vh - 24px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body .messenger-layout .messenger-sidebar,
  body .messenger-layout.mobile-list-visible .messenger-sidebar {
    display: block !important;
    padding: 0 !important;
    overflow: hidden;
    background: var(--asya-td-list) !important;
  }

  body .sidebar-frame {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 0 !important;
    height: 100%;
  }

  body .sidebar-appnav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 72px;
    min-height: 100%;
    padding: 10px 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--asya-td-rail) !important;
    box-shadow: none !important;
  }

  body .sidebar-navicon {
    min-height: 62px;
    width: 72px;
    padding: 7px 4px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--asya-td-muted) !important;
    box-shadow: none !important;
  }

  body .sidebar-navicon:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: var(--asya-td-text) !important;
  }

  body .sidebar-navicon.active {
    background: rgba(53, 214, 198, 0.13) !important;
    color: var(--asya-td-accent) !important;
  }

  body .sidebar-navicon-glyph {
    font-size: 1.25rem;
    line-height: 1;
  }

  body .sidebar-navicon-label {
    max-width: 62px;
    margin-top: 6px;
    color: inherit !important;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0;
  }

  body .sidebar-content {
    height: 100%;
    min-width: 0;
    padding: 10px 12px 0;
    overflow: auto;
    background: var(--asya-td-list) !important;
    scrollbar-color: #4b5964 transparent;
  }

  body .sidebar-content::-webkit-scrollbar,
  body .message-timeline::-webkit-scrollbar,
  body .messenger-rail::-webkit-scrollbar {
    width: 8px;
  }

  body .sidebar-content::-webkit-scrollbar-thumb,
  body .message-timeline::-webkit-scrollbar-thumb,
  body .messenger-rail::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #4b5964;
  }

  body .sidebar-account {
    min-height: 44px;
    padding: 0 0 10px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body .sidebar-account-copy strong,
  body .sidebar-account strong {
    color: var(--asya-td-text) !important;
    font-size: 0.88rem;
    font-weight: 700;
  }

  body .sidebar-account-copy small,
  body .sidebar-account span,
  body .sidebar-account-state-text {
    color: var(--asya-td-muted) !important;
    font-size: 0.78rem;
  }

  body .sidebar-account .avatar-badge,
  body .room-item-avatar,
  body .room-header-avatar {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: 0 !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #45b6f7, #6fce53) !important;
    color: #fff !important;
    box-shadow: none !important;
    font-size: 0.92rem;
    font-weight: 800;
  }

  body .sidebar-search {
    margin: 0 0 10px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body .sidebar-search input,
  body .telegram-search-field {
    min-height: 36px !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: #303b45 !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .sidebar-search input {
    padding: 0 16px !important;
    font-size: 0.88rem !important;
  }

  body .sidebar-search input::placeholder,
  body .telegram-search-field input::placeholder {
    color: #8594a2 !important;
  }

  body .mobile-quick-contacts,
  body .secret-chat-banner {
    display: none !important;
  }

  body .messenger-layout .mobile-folder-tabs {
    display: flex !important;
    gap: 8px;
    margin: 0 0 12px;
    padding: 0 2px 4px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body .messenger-layout .mobile-folder-tabs::-webkit-scrollbar {
    display: none;
  }

  body .messenger-layout .mobile-folder-tab {
    min-width: max-content;
    border-radius: 999px;
  }

  body .space-create-card {
    display: grid !important;
    gap: 10px;
    margin: 0 -12px 8px !important;
    padding: 12px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--asya-td-border) !important;
    border-radius: 0 !important;
    background: #202b33 !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .space-create-card h3 {
    margin: 0;
    color: var(--asya-td-text) !important;
    font-size: 0.92rem;
    font-weight: 700;
  }

  body .space-create-card p {
    margin: 4px 0 0;
    color: var(--asya-td-muted) !important;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  body .space-create-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  body .space-create-form input,
  body .rail-form input,
  body .rail-form textarea,
  body .profile-form input,
  body .profile-form textarea {
    min-height: 36px;
    border: 0 !important;
    border-radius: 6px !important;
    background: #303b45 !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .space-create-form input::placeholder,
  body .rail-form input::placeholder,
  body .rail-form textarea::placeholder,
  body .profile-form input::placeholder,
  body .profile-form textarea::placeholder {
    color: #8594a2 !important;
  }

  body .space-create-form .primary-button,
  body .space-create-actions .primary-button,
  body .space-create-actions .secondary-button {
    min-height: 36px;
    border-radius: 6px !important;
    font-size: 0.84rem;
  }

  body .room-list {
    display: grid;
    gap: 0;
    padding: 0 !important;
  }

  body .room-list-item,
  body .telegram-quick-contact-row {
    min-height: 62px !important;
    width: 100%;
    padding: 7px 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .room-list-item:hover,
  body .telegram-quick-contact-row:hover {
    background: var(--asya-td-list-hover) !important;
  }

  body .room-list-item.active {
    background: var(--asya-td-selected) !important;
  }

  body .room-list-item.active *,
  body .room-list-item.active .room-item-time,
  body .room-list-item.active .room-item-preview {
    color: #fff !important;
  }

  body .room-item-body,
  body .telegram-quick-contact-copy {
    min-width: 0;
    gap: 3px;
  }

  body .room-item-head {
    align-items: baseline;
    gap: 8px;
  }

  body .room-list-item strong,
  body .telegram-quick-contact-copy strong,
  body .room-item-head strong {
    color: var(--asya-td-text) !important;
    font-size: 0.88rem;
    font-weight: 700;
  }

  body .room-item-preview,
  body .room-list-item small,
  body .room-list-item span,
  body .telegram-quick-contact-copy small {
    color: var(--asya-td-muted) !important;
    font-size: 0.83rem;
  }

  body .room-item-time {
    color: #778796 !important;
    font-size: 0.75rem;
    font-weight: 500;
  }

  body .room-list-item .room-kind-pill {
    background: rgba(42, 167, 255, 0.14) !important;
    color: #62b7ff !important;
    font-size: 0.68rem;
    font-weight: 800;
  }

  body .room-item-tail,
  body .presence-dot {
    color: var(--asya-td-accent) !important;
  }

  body .room-list-delete-action,
  body .room-list-item.active .room-list-delete-action {
    width: 30px;
    height: 30px;
    border-color: rgba(255, 91, 112, 0.26) !important;
    background: rgba(255, 91, 112, 0.12) !important;
    color: #ff6b80 !important;
    opacity: 0.9;
  }

  body .messenger-layout .messenger-room,
  body .messenger-layout.mobile-list-visible .messenger-room,
  body .messenger-layout.mobile-room-visible .messenger-room {
    display: grid;
    grid-template-rows: 54px minmax(0, 1fr) auto;
    min-height: calc(100vh - 24px) !important;
    overflow: hidden;
    background: var(--asya-td-room) !important;
    box-shadow: none !important;
  }

  body .room-header {
    min-height: 54px;
    margin: 0 !important;
    padding: 7px 14px !important;
    border: 0 !important;
    border-bottom: 1px solid #222c34 !important;
    border-radius: 0 !important;
    background: var(--asya-td-room-header) !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .room-header-main {
    gap: 11px;
  }

  body .room-header-avatar {
    width: 40px;
    height: 40px;
  }

  body .room-header .sidebar-eyebrow {
    display: none;
  }

  body .room-header h2 {
    color: var(--asya-td-text) !important;
    font-size: 0.92rem !important;
    font-weight: 700;
    line-height: 1.15;
  }

  body .room-header-status {
    margin-top: 2px;
    color: var(--asya-td-muted) !important;
    font-size: 0.78rem;
  }

  body .room-header-actions .secondary-button,
  body .room-header-actions .primary-button {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--asya-td-muted) !important;
    box-shadow: none !important;
    font-size: 0 !important;
  }

  body .room-header-actions .secondary-button:hover,
  body .room-header-actions .primary-button:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--asya-td-text) !important;
  }

  body .room-header-actions [data-call-action="start-audio"]::before {
    content: "\260E";
    font-size: 1rem;
  }

  body .room-header-actions [data-call-action="start-video"]::before {
    content: "\25A3";
    font-size: 0.95rem;
  }

  body .room-header-actions .room-header-rail::before {
    content: "\22EE";
    font-size: 1.2rem;
  }

  body .messenger-layout .message-timeline,
  body .messenger-layout.mobile-list-visible .message-timeline,
  body .messenger-layout.mobile-room-visible .message-timeline,
  body .message-timeline.workspace-landing {
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 18px 0 24px 16px !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: auto;
    background:
      linear-gradient(rgba(17, 22, 28, 0.94), rgba(17, 22, 28, 0.94)),
      radial-gradient(circle at 20px 20px, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 22px) !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .message-timeline.workspace-landing {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0 !important;
  }

  body .workspace-empty-stats,
  body .empty-state-card,
  body [data-testid="dialogs-empty-workspace"] {
    width: 430px;
    max-width: calc(100% - 48px);
    margin: 48px auto 0;
    padding: 22px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body [data-testid="dialogs-empty-workspace"] h2,
  body [data-testid="dialogs-empty-workspace"] h3,
  body [data-testid="dialogs-empty-workspace"] strong,
  body [data-testid="dialogs-empty-workspace"] p,
  body [data-testid="dialogs-empty-workspace"] span {
    color: var(--asya-td-text) !important;
  }

  body [data-testid="dialogs-empty-workspace"] p,
  body [data-testid="dialogs-empty-workspace"] small,
  body .workspace-empty-stats span {
    color: var(--asya-td-muted) !important;
  }

  body .message-card {
    position: relative;
    width: fit-content !important;
    max-width: min(58%, 720px) !important;
    margin: 4px 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .messenger-layout .message-card.self,
  body .messenger-layout .message-card.own {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body .message-card.self,
  body .message-card.own {
    justify-self: end;
    margin-right: 18px !important;
  }

  body .messenger-layout .message-card .message-bubble,
  body .messenger-layout .message-card.self .message-bubble,
  body .messenger-layout .message-card.own .message-bubble {
    min-width: 84px;
    padding: 7px 56px 18px 10px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: var(--asya-td-bubble) !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .messenger-layout .message-card.self .message-bubble,
  body .messenger-layout .message-card.own .message-bubble {
    background: var(--asya-td-bubble-own) !important;
  }

  body .messenger-layout .message-card .message-bubble p,
  body .messenger-layout .message-card .message-bubble span,
  body .messenger-layout .message-card.self .message-bubble p,
  body .messenger-layout .message-card.self .message-bubble span,
  body .messenger-layout .message-card.own .message-bubble p,
  body .messenger-layout .message-card.own .message-bubble span {
    color: inherit !important;
  }

  body .message-card .message-meta {
    position: absolute;
    right: 8px;
    bottom: 4px;
    margin: 0 !important;
    color: rgba(226, 237, 245, 0.62) !important;
    font-size: 0.69rem !important;
  }

  body .composer-box {
    min-height: 58px;
    margin: 0 !important;
    padding: 8px 12px !important;
    border: 0 !important;
    border-top: 1px solid #222c34 !important;
    border-radius: 0 !important;
    background: var(--asya-td-room-header) !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .composer-input-wrap textarea {
    min-height: 40px !important;
    max-height: 132px;
    padding: 10px 12px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .composer-input-wrap textarea::placeholder {
    color: #7f8f9d !important;
  }

  body .composer-input-wrap {
    position: relative;
  }

  body .emoji-picker-shell,
  body .composer-sticker-tray {
    box-sizing: border-box;
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 45;
    width: min(430px, calc(100vw - 24px), 100%);
    min-width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: min(56vh, 420px);
    margin: 0 !important;
    overflow: hidden;
    border: 1px solid #2b3944 !important;
    border-radius: 8px !important;
    background: #202b33 !important;
    color: var(--asya-td-text) !important;
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.42) !important;
  }

  body .composer-sticker-tray {
    display: grid !important;
    gap: 10px;
    padding: 12px !important;
    overflow: auto;
  }

  body .composer-sticker-tray .rail-section-head,
  body .composer-sticker-tray .rail-section-head strong {
    color: var(--asya-td-text) !important;
  }

  body .emoji-picker-shell .rail-section-head,
  body .emoji-picker-shell .rail-section-head strong {
    color: var(--asya-td-text) !important;
  }

  body .emoji-search-field {
    color: var(--asya-td-muted) !important;
  }

  body .emoji-search-field input {
    border-color: #2b3944 !important;
    background: #17212b !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .emoji-category-tabs {
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-inline: contain;
    padding: 0 12px 10px !important;
  }

  body .emoji-category-tab {
    max-width: 126px;
    border-color: #2b3944 !important;
    background: #17212b !important;
    color: var(--asya-td-muted) !important;
    box-shadow: none !important;
  }

  body .emoji-category-tab small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body .emoji-category-tab.active {
    border-color: rgba(46, 166, 255, 0.52) !important;
    background: #24384a !important;
    color: var(--asya-td-accent) !important;
  }

  body .composer-emoji-grid {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
    gap: 6px;
    padding: 12px !important;
    max-height: min(34vh, 260px);
    overflow: auto;
  }

  body .emoji-picker-item {
    min-width: 0;
    min-height: 40px;
    border: 0 !important;
    border-radius: 7px !important;
    background: #17212b !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
    font-size: 1.15rem;
  }

  body .emoji-picker-item:hover {
    background: #263845 !important;
  }

  body .emoji-empty-state {
    color: var(--asya-td-muted) !important;
  }

  body .sticker-pack-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  body .sticker-pack-tab {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 12px !important;
    border: 0 !important;
    border-radius: 15px !important;
    background: #17212b !important;
    color: var(--asya-td-muted) !important;
    box-shadow: none !important;
    font-size: 0.78rem;
    font-weight: 700;
  }

  body .sticker-pack-tab.active {
    background: var(--asya-td-selected) !important;
    color: #fff !important;
  }

  body .composer-sticker-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(44px, 1fr));
    gap: 6px;
    max-height: 260px;
    overflow: auto;
    padding-right: 2px;
  }

  body .sticker-picker-item {
    display: grid;
    place-items: center;
    min-height: 58px;
    padding: 6px !important;
    border: 0 !important;
    border-radius: 7px !important;
    background: #17212b !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .sticker-picker-item:hover {
    background: #263845 !important;
  }

  body .sticker-picker-item img {
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
  }

  body .composer-sticker-tray .runtime-note {
    margin: 0;
    color: var(--asya-td-muted) !important;
  }

  body .composer-side-actions .secondary-button,
  body .composer-box > [data-composer-action="send"] {
    display: inline-grid !important;
    place-items: center;
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--asya-td-muted) !important;
    box-shadow: none !important;
    font-size: 0 !important;
    line-height: 1 !important;
  }

  body .composer-side-actions .secondary-button.active-control {
    background: rgba(42, 171, 238, 0.16) !important;
    color: var(--asya-td-accent) !important;
  }

  body .composer-side-actions [data-composer-action="attach"]::before {
    content: "\1F4CE";
    font-size: 1rem;
  }

  body .composer-side-actions [data-composer-action="emoji"]::before {
    content: "\263A";
    font-size: 1.08rem;
  }

  body .composer-side-actions [data-composer-action="stickers"]::before {
    content: "\25A7";
    font-size: 1rem;
  }

  body .composer-box > [data-composer-action="send"] {
    background: var(--asya-td-accent) !important;
    color: #062522 !important;
  }

  body .composer-box > [data-composer-action="send"]::before {
    content: "\27A4";
    font-size: 1rem;
  }

  body .messenger-rail {
    overflow: auto;
    border-left: 1px solid var(--asya-td-border) !important;
    background: var(--asya-td-list) !important;
  }

  body .rail-card,
  body .settings-summary-card,
  body .settings-profile-card,
  body .settings-contacts-card,
  body .settings-folders-card,
  body .settings-device-card,
  body .settings-security-card,
  body .telegram-person-card,
  body .contact-card,
  body .folder-settings-row {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .settings-overview {
    width: min(392px, calc(100% - 32px));
    max-height: calc(100vh - 88px);
    margin: 40px auto;
    padding: 0 !important;
    overflow: auto;
    border-radius: 7px !important;
    background: var(--asya-td-list) !important;
    color: var(--asya-td-text) !important;
    box-shadow: 0 18px 64px rgba(0, 0, 0, 0.45) !important;
  }

  body .settings-hero {
    min-height: 154px;
    padding: 26px 24px 18px !important;
    border: 0 !important;
    border-bottom: 8px solid rgba(0, 0, 0, 0.16) !important;
    border-radius: 0 !important;
    background: #26323b !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .settings-hero-copy h3 {
    color: var(--asya-td-text) !important;
    font-size: 1rem !important;
    font-weight: 700;
  }

  body .settings-hero-copy p,
  body .settings-status-row,
  body .settings-status-row span {
    color: var(--asya-td-muted) !important;
  }

  body .settings-nav {
    display: grid;
    gap: 0;
    padding: 8px 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  body .settings-nav-item {
    justify-content: flex-start;
    min-height: 40px;
    padding: 0 24px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--asya-td-text) !important;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: none !important;
  }

  body .settings-nav-item:hover,
  body .settings-nav-item.active {
    background: var(--asya-td-list-hover) !important;
    color: var(--asya-td-accent) !important;
  }

  body .sidebar-eyebrow,
  body .rail-section-head p,
  body .settings-section-head p {
    color: var(--asya-td-muted) !important;
  }

  body .primary-button {
    border: 0 !important;
    background: var(--asya-td-selected) !important;
    color: #fff !important;
    box-shadow: none !important;
  }

  body .secondary-button,
  body .ghost-link {
    border-color: transparent !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }
}

body .telegram-security-panel {
  background:
    radial-gradient(circle at 14% 0%, rgba(45, 169, 255, 0.15), transparent 34%),
    var(--asya-td-list, #172331) !important;
}

body .telegram-security-list {
  background: var(--asya-td-panel, #1d2a38) !important;
}

body .telegram-security-row {
  background: transparent !important;
}

body .telegram-security-row:hover {
  background: var(--asya-td-list-hover, #223241) !important;
}

body .telegram-security-row.active {
  background: rgba(42, 171, 238, 0.11) !important;
}

.telegram-security-detail {
  display: grid;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--asya-td-border, rgba(145, 168, 197, 0.12));
  background: rgba(18, 28, 39, 0.68);
}

.telegram-security-detail strong {
  color: #f7fbff;
  font-size: 0.94rem;
}

.telegram-security-detail p {
  max-width: 62ch;
  margin: 0;
  color: #9caabd;
  font-size: 0.84rem;
  line-height: 1.42;
}

.telegram-security-detail .secondary-button {
  justify-self: start;
  width: auto;
}

.two-factor-settings,
.two-factor-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.two-factor-form {
  max-width: 440px;
  margin-top: 4px;
}

.two-factor-form label {
  color: #cbd6e3;
  font-size: 0.78rem;
  font-weight: 700;
}

.two-factor-form input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid rgba(145, 168, 197, 0.2);
  border-radius: 11px;
  outline: none;
  color: #f7fbff;
  background: rgba(8, 17, 27, 0.72);
}

.two-factor-form input:focus {
  border-color: #2aabee;
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.12);
}

.two-factor-form .primary-button,
.two-factor-form .secondary-button {
  justify-self: start;
  width: auto;
  max-width: 100%;
}

.totp-qr {
  display: inline-flex;
  justify-self: start;
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
}

.totp-qr svg {
  display: block;
  width: min(196px, calc(100vw - 96px));
  height: auto;
  aspect-ratio: 1;
}

.totp-secret {
  overflow-wrap: anywhere;
  padding: 10px 12px;
  border: 1px dashed rgba(145, 168, 197, 0.32);
  border-radius: 10px;
  color: #d9e8f7;
  background: rgba(8, 17, 27, 0.72);
  font-family: "Cascadia Mono", "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.totp-backup-codes {
  display: grid;
  gap: 8px;
  max-width: 520px;
  padding: 12px;
  border: 1px solid rgba(114, 216, 165, 0.28);
  border-radius: 12px;
  background: rgba(33, 120, 82, 0.1);
}

.totp-backup-codes > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.totp-backup-codes code {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 8px;
  color: #e8fff3;
  text-align: center;
  background: rgba(4, 20, 13, 0.45);
}

@media (max-width: 440px) {
  .totp-backup-codes > div {
    grid-template-columns: minmax(0, 1fr);
  }
}

.telegram-security-detail .two-factor-success {
  color: #72d8a5;
}

.telegram-security-detail .two-factor-error {
  color: #ff9a9a;
}

.privacy-settings {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.privacy-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(100%, 520px);
  padding: 10px 12px;
  border: 1px solid rgba(145, 168, 197, 0.14);
  border-radius: 12px;
  color: #f7fbff;
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
}

.privacy-option:hover,
.privacy-option.active {
  border-color: rgba(42, 171, 238, 0.45);
  background: rgba(42, 171, 238, 0.1);
}

.privacy-option-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(145, 168, 197, 0.35);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(42, 171, 238, 0.12);
}

.privacy-option.active .privacy-option-check {
  border-color: #2aabee;
  background: #2aabee;
}

.privacy-option strong,
.privacy-option small {
  display: block;
}

.privacy-option small {
  margin-top: 2px;
  color: #9caabd;
  font-size: 0.76rem;
  line-height: 1.35;
}

.security-session-list {
  display: grid;
  gap: 8px;
  margin: 4px 0 2px;
}

.security-session-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(145, 168, 197, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.security-session-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #2aabee, #1678d8);
  font-size: 0.8rem;
  font-weight: 800;
}

.security-session-copy {
  min-width: 0;
}

.security-session-copy strong,
.telegram-security-detail .security-session-copy strong {
  display: block;
  overflow: hidden;
  color: #f7fbff;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-session-copy small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #9caabd;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-session-badge {
  justify-self: end;
  padding: 5px 9px;
  border-radius: 999px;
  color: #7bd3ff;
  background: rgba(42, 171, 238, 0.12);
  font-size: 0.72rem;
  font-weight: 800;
}

@media (min-width: 901px) {
  body .messenger-shell[data-shell-mode="settings"] {
    grid-template-columns: 504px minmax(0, 1fr) !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .messenger-rail {
    display: none !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .messenger-room {
    width: 100% !important;
    min-width: 0 !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .message-timeline {
    display: block !important;
    min-height: calc(100vh - 66px) !important;
    height: calc(100vh - 66px) !important;
    padding: 32px 40px !important;
    overflow: auto !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-overview {
    display: grid !important;
    grid-template-columns: 224px minmax(420px, 620px);
    align-items: start;
    gap: 20px;
    width: min(900px, calc(100% - 32px)) !important;
    max-height: none !important;
    min-height: auto !important;
    height: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-hero {
    display: none !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-nav {
    position: sticky !important;
    top: 0;
    grid-column: 1;
    grid-row: 1 / span 8;
    display: grid !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    overflow: hidden !important;
    border-radius: 14px !important;
    background: var(--asya-td-list) !important;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22) !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-nav-item {
    min-height: 44px !important;
    padding: 0 18px !important;
    border-bottom: 1px solid var(--asya-td-border) !important;
    border-radius: 0 !important;
    color: var(--asya-td-text) !important;
    font-size: 0.9rem;
    text-align: left;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-nav-item:last-child {
    border-bottom: 0 !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-nav-item:hover,
  body .messenger-shell[data-shell-mode="settings"] .settings-nav-item.active {
    background: var(--asya-td-list-hover) !important;
    color: var(--asya-td-accent) !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-summary-card,
  body .messenger-shell[data-shell-mode="settings"] .settings-profile-card,
  body .messenger-shell[data-shell-mode="settings"] .settings-contacts-card,
  body .messenger-shell[data-shell-mode="settings"] .settings-folders-card,
  body .messenger-shell[data-shell-mode="settings"] .telegram-security-panel {
    grid-column: 2;
    width: 100%;
    border-radius: 14px !important;
    background: var(--asya-td-list) !important;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22) !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-summary-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    margin-bottom: 14px;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-summary-card div {
    min-height: 54px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--asya-td-border);
    background: transparent !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-summary-card div:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-profile-card,
  body .messenger-shell[data-shell-mode="settings"] .settings-contacts-card,
  body .messenger-shell[data-shell-mode="settings"] .settings-folders-card {
    padding: 18px !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 14px;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-section-head h3 {
    margin: 0 !important;
    color: var(--asya-td-text) !important;
    font-size: 1.05rem;
  }

  body .messenger-shell[data-shell-mode="settings"] .settings-section-head .runtime-note,
  body .messenger-shell[data-shell-mode="settings"] .runtime-note {
    color: var(--asya-td-muted) !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .profile-avatar-editor {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: #26323b;
  }

  body .messenger-shell[data-shell-mode="settings"] .profile-avatar-actions {
    justify-content: start;
  }

  body .messenger-shell[data-shell-mode="settings"] .rail-form,
  body .messenger-shell[data-shell-mode="settings"] .profile-form,
  body .messenger-shell[data-shell-mode="settings"] .space-create-form {
    display: grid;
    gap: 10px;
  }

  body .messenger-shell[data-shell-mode="settings"] .rail-form input,
  body .messenger-shell[data-shell-mode="settings"] .rail-form textarea,
  body .messenger-shell[data-shell-mode="settings"] .profile-date-field,
  body .messenger-shell[data-shell-mode="settings"] .space-create-form input {
    border: 1px solid var(--asya-td-border) !important;
    border-radius: 10px !important;
    background: #17212b !important;
    color: var(--asya-td-text) !important;
    box-shadow: none !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .contact-cards,
  body .messenger-shell[data-shell-mode="settings"] .folder-settings-list {
    display: grid;
    gap: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #26323b;
  }

  body .messenger-shell[data-shell-mode="settings"] .contact-card,
  body .messenger-shell[data-shell-mode="settings"] .folder-settings-row {
    border-bottom: 1px solid var(--asya-td-border) !important;
    background: transparent !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .contact-card:last-child,
  body .messenger-shell[data-shell-mode="settings"] .folder-settings-row:last-child {
    border-bottom: 0 !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-panel {
    padding: 0 !important;
    overflow: hidden !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-panel > .settings-section-head,
  body .messenger-shell[data-shell-mode="settings"] .telegram-security-panel > .profile-grid,
  body .messenger-shell[data-shell-mode="settings"] .telegram-security-panel > .compact-actions.section-gap {
    display: none !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-hero {
    min-height: 96px;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 14px;
    padding: 18px 22px !important;
    border-bottom: 1px solid var(--asya-td-border);
    background: #26323b;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-avatar {
    width: 46px;
    height: 46px;
    font-size: 1rem;
    box-shadow: none;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-hero h3 {
    margin: 1px 0 4px;
    font-size: 1.12rem !important;
    line-height: 1.18;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-hero p {
    max-width: 30ch;
    font-size: 0.86rem;
    line-height: 1.35;
  }

  body .messenger-shell[data-shell-mode="settings"] .security-state-pill,
  body .messenger-shell[data-shell-mode="settings"] .telegram-security-value {
    padding: 5px 9px;
    font-size: 0.75rem;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-list {
    border-radius: 0 !important;
    background: transparent !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 13px;
    min-height: 64px !important;
    padding: 11px 22px !important;
    border-radius: 0 !important;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.6rem;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-row strong {
    font-size: 0.93rem;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-row small,
  body .messenger-shell[data-shell-mode="settings"] .telegram-security-row em {
    margin-top: 2px;
    font-size: 0.78rem;
    line-height: 1.28;
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 22px 18px;
    background: #202b33;
    border-top: 1px solid var(--asya-td-border);
  }

  body .messenger-shell[data-shell-mode="settings"] .telegram-security-actions .secondary-button {
    min-height: 38px;
    justify-content: center;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    font-size: 0.82rem;
  }
}

@media (max-width: 760px) {
  body .telegram-security-panel {
    padding: 18px !important;
    border-radius: 0 !important;
  }

  body .telegram-security-hero {
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: start;
  }

  body .telegram-security-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.05rem;
  }

  body .telegram-security-hero .security-state-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  body .telegram-security-row {
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 68px;
    padding: 13px 12px;
  }

  body .telegram-security-icon {
    width: 36px;
    height: 36px;
  }

  body .telegram-security-value {
    grid-column: 2;
    justify-self: start;
    margin-top: 4px;
    padding: 5px 9px;
    white-space: normal;
  }

  body .telegram-security-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  body .telegram-security-actions .secondary-button {
    width: 100%;
  }
}

@media (min-width: 901px) {
  body .messenger-layout .space-admin-panel .rail-section-head h3 {
    color: #f5f8fb !important;
  }
}
