:root {
  color-scheme: light;
  --bg: #e8eef5;
  --rail: #f8fbff;
  --rail-2: #ffffff;
  --panel: #ffffff;
  --soft: #f6f8fb;
  --ink: #18212f;
  --muted: #697586;
  --line: #dbe2ea;
  --teal: #1d86d9;
  --teal-2: #2aa3ef;
  --teal-soft: #e6f4ff;
  --blue: #3653d7;
  --coral: #e05a47;
  --amber: #f5b942;
  --shadow: 0 24px 70px rgba(24, 33, 47, 0.13);
  --tight-shadow: 0 10px 30px rgba(24, 33, 47, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #e8f3fb 0%, #f3f6fa 46%, #f8eee9 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) minmax(280px, 340px);
  width: min(1480px, calc(100vw - 28px));
  height: min(940px, calc(100vh - 28px));
  margin: 14px auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--rail), var(--rail-2));
  color: var(--ink);
}

.sidebar__header,
.conversation__header,
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sidebar__header {
  padding: 22px 20px 14px;
}

.header-actions {
  display: grid;
  grid-template-columns: repeat(2, 38px);
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: var(--teal);
}

.connection {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

h1 {
  font-size: 26px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  font-size: 14px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.icon-glyph {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  font-size: 17px;
  line-height: 1;
}

.icon-glyph--gear {
  font-size: 20px;
}

.sidebar .icon-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-button:hover,
.icon-button.is-active {
  transform: translateY(-1px);
  border-color: rgba(42, 163, 239, 0.56);
  background: var(--teal-soft);
  color: var(--teal);
}

#notificationsButton.is-active {
  border-color: rgba(29, 134, 217, 0.54);
  background: #e8f6ef;
  color: #147a4b;
}

.icon-button--tiny {
  width: 32px;
  height: 32px;
}

.toast-stack {
  position: fixed;
  z-index: 30;
  top: 18px;
  right: 18px;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(42, 163, 239, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--tight-shadow);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast strong {
  font-size: 14px;
}

.toast span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 18px 14px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
}

.sidebar .search {
  border-color: var(--line);
  background: var(--soft);
  color: var(--muted);
}

.search:focus-within {
  border-color: rgba(42, 163, 239, 0.58);
  background: #fff;
}

.sidebar .search:focus-within {
  background: #fff;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 18px 14px;
}

.tab {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sidebar .tab {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.tab.is-active {
  border-color: transparent;
  background: var(--teal-2);
  color: #fff;
}

.chat-list {
  overflow: auto;
  padding: 0 10px 18px;
}

.chat-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  align-items: center;
  margin-bottom: 6px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.chat-item:hover,
.chat-item.is-active {
  border-color: rgba(42, 163, 239, 0.22);
  background: var(--teal-soft);
}

.chat-item.is-active {
  box-shadow: inset 3px 0 0 var(--teal-2);
}

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-weight: 900;
}

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

.avatar--large {
  width: 78px;
  height: 78px;
  margin: 0 auto 12px;
  font-size: 26px;
}

.avatar--settings {
  width: 96px;
  height: 96px;
  font-size: 30px;
}

.avatar--small {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.chat-main,
.conversation__title {
  min-width: 0;
}

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

.chat-title {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview {
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-meta {
  display: flex;
  min-width: 44px;
  flex-direction: column;
  align-items: end;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 22px;
  text-align: center;
}

.pin {
  color: var(--amber);
}

.conversation {
  display: grid;
  min-width: 0;
  grid-template-rows: auto auto 1fr auto auto;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.95), rgba(255, 255, 255, 0.98)),
    repeating-linear-gradient(135deg, rgba(42, 163, 239, 0.055) 0 1px, transparent 1px 24px),
    var(--panel);
}

.conversation__header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.conversation__title {
  flex: 1;
}

.conversation__title h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation__title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.conversation__actions {
  display: flex;
  gap: 8px;
}

.message-search {
  padding-top: 14px;
}

.messages {
  display: flex;
  overflow: auto;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
}

.message {
  display: grid;
  max-width: min(680px, 84%);
  gap: 5px;
  position: relative;
  transition: filter 0.18s ease;
}

.message.is-me {
  align-self: end;
}

.message.is-them {
  align-self: start;
}

.message__bubble {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--tight-shadow);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.message.is-me .message__bubble {
  border-color: rgba(42, 163, 239, 0.26);
  background: linear-gradient(135deg, #dff2ff, #cfeeff);
  color: #12324a;
}

.message.is-deleted .message__bubble {
  border-color: #e1e7ee;
  background: #f3f6f9;
  color: #7a8794;
  box-shadow: none;
}

.message.is-highlighted {
  filter: drop-shadow(0 0 0.55rem rgba(42, 163, 239, 0.38));
}

.message__tools {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.message:hover .message__tools,
.message:focus-within .message__tools {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.message.is-me .message__tools {
  justify-content: flex-end;
}

.message-action,
.reaction-button,
.reaction-pill {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.message-action:hover,
.reaction-button:hover,
.reaction-pill:hover,
.reaction-pill.is-mine {
  border-color: rgba(42, 163, 239, 0.38);
  background: var(--teal-soft);
  color: var(--teal);
}

.reaction-menu {
  display: flex;
  gap: 3px;
  padding-left: 2px;
}

.message__reply {
  display: grid;
  width: 100%;
  gap: 2px;
  margin-bottom: 8px;
  padding: 7px 9px;
  border: 0;
  border-left: 3px solid var(--teal);
  border-radius: 8px;
  background: rgba(29, 134, 217, 0.08);
  color: inherit;
  text-align: left;
}

.message__reply span,
.reply-bar__body strong {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.message__reply small,
.reply-bar__body span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message.is-me .message__reply {
  border-left-color: #1d86d9;
  background: rgba(255, 255, 255, 0.44);
}

.message__reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.reaction-pill {
  grid-auto-flow: column;
  gap: 4px;
  width: auto;
  padding: 0 8px;
}

.reaction-pill strong {
  font-size: 11px;
}

.message__deleted {
  font-style: italic;
}

.encrypted-placeholder {
  color: var(--muted);
  font-style: italic;
}

.message-media {
  display: block;
  width: min(420px, 68vw);
  max-height: 460px;
  border-radius: 8px;
  object-fit: contain;
  background: #0f172a;
}

.message-media--image {
  background: transparent;
}

.message__meta {
  color: var(--muted);
  font-size: 12px;
}

.message.is-me .message__meta {
  text-align: right;
}

.message mark {
  border-radius: 4px;
  background: #fff0a7;
  color: inherit;
}

.day-divider {
  align-self: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.typing-bar {
  min-height: 28px;
  padding: 0 22px 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.reply-bar {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 3px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(42, 163, 239, 0.22);
  border-radius: 8px;
  background: var(--teal-soft);
}

.reply-bar[hidden] {
  display: none;
}

.reply-bar__line {
  width: 3px;
  height: 100%;
  min-height: 34px;
  border-radius: 999px;
  background: var(--teal);
}

.reply-bar__body {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.composer input {
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--soft);
}

.media-input {
  display: none;
}

.composer input:focus,
.modal input:focus,
.modal textarea:focus,
.login-card input:focus,
.login-card textarea:focus,
.invite-row select:focus {
  border-color: rgba(42, 163, 239, 0.62);
  background: #fff;
}

.send-button,
.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.send-button {
  padding: 0 18px;
}

.send-button:hover,
.primary-button:hover {
  background: #126fb7;
}

.icon-button.is-recording {
  border-color: rgba(217, 93, 57, 0.7);
  background: #ffe8df;
  color: var(--coral);
}

.primary-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button--compact {
  min-height: 38px;
  padding: 0 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 900;
}

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

.details {
  overflow: auto;
  padding: 20px;
  border-left: 1px solid var(--line);
  background: var(--soft);
}

.details__card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
  box-shadow: var(--tight-shadow);
}

.details__card p,
.details__section small {
  color: var(--muted);
}

.details__section {
  margin-top: 22px;
}

.member-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.invite-row select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.member,
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.member--rich {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
}

.member__main {
  min-width: 0;
}

.member__main strong,
.member__main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member__actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px;
  margin-top: 7px;
}

.mini-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.mini-button.danger {
  color: var(--coral);
}

.admin-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

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

.admin-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.report-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

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

.report-row__main {
  min-width: 0;
}

.report-row__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 180px;
}

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

.report-row__main small {
  white-space: normal;
}

.member span,
.session-row small {
  color: var(--muted);
  font-size: 13px;
}

.key-fingerprint {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--teal);
}

.file-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.file-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: #edf2f7;
  color: var(--blue);
  font-weight: 900;
}

.modal,
.login-modal {
  width: min(460px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.settings-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.login-modal::backdrop,
.modal::backdrop {
  background: rgba(24, 33, 47, 0.55);
}

.login-card,
.modal__content {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: #fff;
}

.settings-panel {
  gap: 18px;
}

.modal__header {
  padding-bottom: 2px;
}

.login-card label,
.modal label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-card input,
.modal input,
.modal textarea,
.login-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  outline: 0;
  background: var(--soft);
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.voice-player {
  display: block;
  width: min(280px, 62vw);
  height: 36px;
}

.modal textarea,
.login-card textarea {
  min-height: 104px;
  resize: vertical;
}

.password-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf4;
}

.password-meter span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
  transition: width 0.18s ease, background 0.18s ease;
}

.password-meter[data-score="4"] span,
.password-meter[data-score="5"] span {
  background: var(--amber);
}

.password-meter[data-score="6"] span {
  background: var(--teal);
}

.security-hint {
  color: var(--muted);
  font-size: 13px;
}

.security-panel {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.settings-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.settings-section--profile {
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
}

.settings-avatar {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.settings-avatar__actions {
  display: grid;
  width: 100%;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

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

.security-grid {
  display: grid;
  gap: 10px;
}

.security-tile {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.security-tile small {
  color: var(--muted);
  line-height: 1.4;
}

.security-tile code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

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

.key-warning-list,
.key-warning {
  display: grid;
  gap: 6px;
}

.key-warning {
  border-left: 3px solid var(--coral);
  padding-left: 9px;
}

.auth-avatar-row {
  display: grid;
  grid-template-columns: 36px minmax(0, auto);
  gap: 8px 10px;
  align-items: center;
}

.auth-avatar-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

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

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.upload-button {
  display: inline-grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid rgba(42, 163, 239, 0.34);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.form-error {
  min-height: 18px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 800;
}

.form-error.is-success {
  color: var(--teal);
}

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

.modal-tabs .tab {
  width: 100%;
}

.field-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.user-list,
.check-list {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
}

.user-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.user-row:hover {
  border-color: rgba(42, 163, 239, 0.55);
  background: var(--teal-soft);
}

.user-row small,
.check-row small {
  display: block;
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.mobile-only {
  display: none;
}

.empty-state {
  margin: auto;
  max-width: 360px;
  color: var(--muted);
  text-align: center;
}

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

  .details {
    position: fixed;
    top: 14px;
    right: 14px;
    bottom: 14px;
    width: min(340px, calc(100vw - 28px));
    transform: translateX(calc(100% + 20px));
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    z-index: 5;
  }

  .details.is-open {
    transform: translateX(0);
  }
}

@media (max-width: 760px) {
  body {
    background: var(--bg);
  }

  .app-shell {
    width: 100vw;
    height: 100vh;
    margin: 0;
    grid-template-columns: 1fr;
    border: 0;
  }

  .sidebar,
  .conversation {
    grid-column: 1;
    grid-row: 1;
    min-height: 100vh;
  }

  .conversation {
    transform: translateX(100%);
    transition: transform 0.2s ease;
  }

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

  .sidebar__header,
  .conversation__header {
    padding: 16px;
  }

  .header-actions {
    grid-template-columns: repeat(4, 36px);
  }

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

  .search,
  .tabs {
    margin-left: 16px;
    margin-right: 16px;
    padding-left: 0;
    padding-right: 0;
  }

  .search {
    padding: 10px 12px;
  }

  .messages {
    padding: 16px;
  }

  .message {
    max-width: 92%;
  }

  .message__tools {
    overflow-x: auto;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .toast-stack {
    top: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .typing-bar {
    padding: 0 16px 8px;
  }

  .composer {
    padding: 12px 16px 16px;
  }

  .settings-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .settings-panel {
    min-height: 100vh;
    padding: 18px;
    overflow: auto;
  }

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

  .settings-avatar {
    justify-items: start;
  }

  .settings-avatar__actions {
    justify-items: start;
    text-align: left;
  }

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

  .report-row__actions {
    justify-content: flex-start;
    max-width: none;
  }

  .mobile-only {
    display: inline-grid;
  }

  .send-button span {
    display: none;
  }

  .send-button::after {
    content: ">";
    font-weight: 900;
  }
}

/* Nexa premium redesign */
:root {
  color-scheme: dark;
  --bg: #050615;
  --rail: rgba(8, 12, 35, 0.96);
  --rail-2: rgba(10, 15, 43, 0.94);
  --panel: rgba(11, 16, 45, 0.95);
  --soft: rgba(19, 25, 62, 0.88);
  --ink: #f7f8ff;
  --muted: #9ca8cc;
  --line: rgba(153, 169, 226, 0.17);
  --teal: #1dd9ff;
  --teal-2: #7c4dff;
  --blue: #236dff;
  --coral: #ff5f93;
  --amber: #ffd166;
  --green: #1ee69f;
  --violet: #9a3dff;
  --bubble-in: rgba(26, 34, 75, 0.9);
  --bubble-out: linear-gradient(135deg, #12c8ff 0%, #2558ff 42%, #7b35ff 100%);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --tight-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
  --glow: 0 0 0 1px rgba(109, 95, 255, 0.18), 0 20px 55px rgba(71, 60, 255, 0.28);
}

html {
  background: var(--bg);
}

body {
  background:
    linear-gradient(115deg, rgba(24, 218, 255, 0.11), transparent 30%),
    linear-gradient(245deg, rgba(154, 61, 255, 0.15), transparent 34%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 24px),
    #050615;
  color: var(--ink);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 84%, transparent);
  content: "";
}

::selection {
  background: rgba(29, 217, 255, 0.32);
  color: #fff;
}

* {
  scrollbar-color: rgba(124, 77, 255, 0.58) rgba(255, 255, 255, 0.04);
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  grid-template-columns: minmax(315px, 390px) minmax(0, 1fr) minmax(292px, 350px);
  border-color: rgba(177, 191, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(12, 17, 48, 0.94), rgba(7, 11, 33, 0.97)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
}

.sidebar {
  border-right-color: var(--line);
  background:
    linear-gradient(180deg, rgba(14, 20, 54, 0.98), rgba(6, 10, 30, 0.98)),
    var(--rail);
}

.sidebar__header {
  align-items: flex-start;
  padding: 26px 22px 18px;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.brand-lockup--large {
  align-items: center;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(80, 218, 255, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(36, 219, 255, 0.95), rgba(38, 76, 255, 0.95) 48%, rgba(159, 55, 255, 0.96)),
    #1937ff;
  color: #fff;
  font-size: 30px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 16px 36px rgba(55, 87, 255, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.brand-mark::after {
  position: absolute;
  right: 4px;
  bottom: -5px;
  width: 14px;
  height: 14px;
  border-bottom-right-radius: 8px;
  background: inherit;
  transform: rotate(45deg);
  content: "";
}

.brand-lockup h1,
.sidebar__header h1 {
  color: #fff;
  font-size: 42px;
  font-weight: 950;
  line-height: 0.95;
  text-shadow: 0 12px 34px rgba(255, 255, 255, 0.1);
}

.brand-tag {
  margin-top: 8px;
  color: #7f95ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.eyebrow,
.sidebar .eyebrow {
  color: #8d9cff;
}

.connection {
  margin-top: 8px;
  color: rgba(156, 168, 204, 0.86);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  max-width: 98px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-color: rgba(156, 168, 204, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(35, 47, 98, 0.78), rgba(15, 21, 56, 0.86)),
    rgba(16, 23, 61, 0.92);
  color: #dbe2ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar .icon-button {
  border-color: rgba(156, 168, 204, 0.18);
  background:
    linear-gradient(180deg, rgba(35, 47, 98, 0.78), rgba(15, 21, 56, 0.86)),
    rgba(16, 23, 61, 0.92);
  color: #dbe2ff;
}

.icon-button:hover,
.icon-button.is-active,
.sidebar .icon-button:hover {
  border-color: rgba(29, 217, 255, 0.58);
  background: linear-gradient(135deg, rgba(29, 217, 255, 0.26), rgba(124, 77, 255, 0.42));
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(72, 70, 255, 0.28);
}

#notificationsButton.is-active {
  border-color: rgba(30, 230, 159, 0.62);
  background: linear-gradient(135deg, rgba(30, 230, 159, 0.28), rgba(29, 217, 255, 0.22));
  color: #dfffee;
}

.search {
  min-height: 56px;
  margin: 0 22px 18px;
  padding: 0 18px;
  border-color: rgba(156, 168, 204, 0.18);
  border-radius: 8px;
  background: rgba(17, 23, 58, 0.76);
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar .search {
  border-color: rgba(156, 168, 204, 0.18);
  background: rgba(17, 23, 58, 0.76);
  color: var(--muted);
}

.search:focus-within,
.sidebar .search:focus-within {
  border-color: rgba(29, 217, 255, 0.64);
  background: rgba(14, 22, 62, 0.96);
  box-shadow: 0 0 0 3px rgba(29, 217, 255, 0.08);
}

.search input,
.composer input,
.modal input,
.modal textarea,
.login-card input,
.login-card textarea {
  color: var(--ink);
}

.search input::placeholder,
.composer input::placeholder,
.modal input::placeholder,
.modal textarea::placeholder,
.login-card input::placeholder {
  color: rgba(179, 187, 222, 0.72);
}

.tabs {
  position: relative;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 0 22px 16px;
  border-bottom: 1px solid rgba(156, 168, 204, 0.1);
}

.tab,
.sidebar .tab {
  position: relative;
  height: 42px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(202, 209, 240, 0.72);
  font-weight: 850;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.tab.is-active {
  background: linear-gradient(135deg, rgba(29, 217, 255, 0.16), rgba(124, 77, 255, 0.2));
  color: #fff;
}

.tab.is-active::after {
  position: absolute;
  right: 14px;
  bottom: -16px;
  left: 14px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1dd9ff, #9a3dff);
  box-shadow: 0 0 18px rgba(124, 77, 255, 0.74);
  content: "";
}

.chat-list {
  padding: 12px 12px 18px;
}

.chat-item {
  grid-template-columns: 60px minmax(0, 1fr) auto;
  min-height: 86px;
  gap: 14px;
  margin-bottom: 4px;
  padding: 12px 10px;
  border-color: transparent;
  border-radius: 8px;
}

.chat-item:hover,
.chat-item.is-active {
  border-color: rgba(29, 217, 255, 0.2);
  background: linear-gradient(135deg, rgba(29, 217, 255, 0.09), rgba(124, 77, 255, 0.13));
}

.chat-item.is-active {
  box-shadow: inset 3px 0 0 #7c4dff, 0 12px 28px rgba(0, 0, 0, 0.18);
}

.avatar {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(117, 88, 255, 0.72);
  border-radius: 50%;
  background: var(--bubble-out);
  color: #fff;
  box-shadow: 0 10px 24px rgba(62, 69, 255, 0.28);
}

.avatar::after {
  position: absolute;
}

.avatar--small {
  width: 38px;
  height: 38px;
}

.avatar--large {
  width: 84px;
  height: 84px;
  margin-bottom: 14px;
}

.avatar--settings {
  width: 104px;
  height: 104px;
}

.chat-title {
  color: #fff;
  font-size: 16px;
}

.chat-preview {
  margin-top: 7px;
  color: rgba(197, 204, 235, 0.8);
  font-size: 14px;
}

.chat-meta {
  color: rgba(197, 204, 235, 0.82);
  font-size: 12px;
}

.badge {
  min-width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #8c4dff, #5f2cff);
  box-shadow: 0 8px 20px rgba(124, 77, 255, 0.42);
  line-height: 24px;
}

.pin {
  color: var(--amber);
  filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.45));
}

.conversation {
  position: relative;
  background:
    linear-gradient(180deg, rgba(5, 8, 27, 0.84), rgba(5, 8, 27, 0.96)),
    radial-gradient(circle at 20% 20%, rgba(29, 217, 255, 0.04) 0 1px, transparent 1px 32px),
    radial-gradient(circle at 80% 55%, rgba(154, 61, 255, 0.05) 0 1px, transparent 1px 28px),
    #070a1f;
}

.conversation::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(30deg, transparent 0 46%, rgba(255, 255, 255, 0.02) 47% 49%, transparent 50%),
    linear-gradient(150deg, transparent 0 46%, rgba(255, 255, 255, 0.016) 47% 49%, transparent 50%);
  background-size: 86px 86px;
  opacity: 0.38;
  content: "";
}

.conversation > * {
  position: relative;
}

.conversation__header {
  min-height: 74px;
  padding: 16px 22px;
  border-bottom-color: rgba(156, 168, 204, 0.1);
  background:
    linear-gradient(180deg, rgba(21, 27, 65, 0.98), rgba(13, 18, 49, 0.92)),
    rgba(12, 17, 47, 0.96);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.conversation__title h2 {
  color: #fff;
  font-size: 20px;
  font-weight: 950;
}

.conversation__title p {
  color: rgba(191, 200, 236, 0.8);
}

.message-search {
  padding-top: 14px;
}

.message-search .search {
  min-height: 44px;
  margin-bottom: 0;
}

.messages {
  gap: 13px;
  padding: 24px;
}

.message {
  max-width: min(640px, 82%);
}

.message__bubble {
  position: relative;
  overflow: visible;
  border-color: rgba(156, 168, 204, 0.13);
  border-radius: 8px;
  padding: 13px 15px;
  background:
    linear-gradient(180deg, rgba(33, 42, 91, 0.94), rgba(19, 26, 64, 0.95)),
    var(--bubble-in);
  color: #f4f6ff;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.message.is-them .message__bubble::after,
.message.is-me .message__bubble::after {
  position: absolute;
  bottom: -1px;
  width: 16px;
  height: 16px;
  background: inherit;
  content: "";
}

.message.is-them .message__bubble::after {
  left: -5px;
  clip-path: polygon(100% 0, 0 100%, 100% 82%);
}

.message.is-me .message__bubble {
  border-color: rgba(29, 217, 255, 0.32);
  background: var(--bubble-out);
  color: #fff;
  box-shadow: 0 18px 48px rgba(51, 80, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.message.is-me .message__bubble::after {
  right: -5px;
  clip-path: polygon(0 0, 0 82%, 100% 100%);
}

.message.is-deleted .message__bubble {
  border-color: rgba(156, 168, 204, 0.12);
  background: rgba(30, 36, 67, 0.68);
  color: rgba(197, 204, 235, 0.68);
  box-shadow: none;
}

.message__meta {
  color: rgba(190, 199, 232, 0.76);
}

.message.is-me .message__meta {
  color: rgba(214, 232, 255, 0.82);
}

.message__tools {
  gap: 6px;
}

.message-action,
.reaction-button,
.reaction-pill {
  border-color: rgba(156, 168, 204, 0.16);
  border-radius: 999px;
  background: rgba(20, 27, 65, 0.88);
  color: rgba(218, 224, 250, 0.86);
}

.message-action:hover,
.reaction-button:hover,
.reaction-pill:hover,
.reaction-pill.is-mine {
  border-color: rgba(29, 217, 255, 0.45);
  background: rgba(29, 217, 255, 0.14);
  color: #fff;
}

.message__reply {
  border-left-color: #1dd9ff;
  border-radius: 8px;
  background: rgba(4, 9, 30, 0.26);
}

.message.is-me .message__reply {
  background: rgba(255, 255, 255, 0.16);
}

.message__reply span,
.reply-bar__body strong {
  color: #90f0ff;
}

.message__reply small,
.reply-bar__body span {
  color: rgba(230, 235, 255, 0.74);
}

.message-media {
  width: min(420px, 68vw);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #050615;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.message-media--image {
  background: #050615;
}

.voice-player {
  width: min(330px, 62vw);
  height: 38px;
  accent-color: #7c4dff;
}

.day-divider {
  border-color: rgba(156, 168, 204, 0.16);
  background: rgba(19, 25, 62, 0.82);
  color: rgba(226, 231, 255, 0.82);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.typing-bar {
  color: #b980ff;
}

.composer {
  grid-template-columns: 46px minmax(0, 1fr) 46px 54px;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top-color: rgba(156, 168, 204, 0.11);
  background:
    linear-gradient(180deg, rgba(8, 12, 35, 0.62), rgba(10, 14, 40, 0.96)),
    rgba(8, 12, 35, 0.94);
  backdrop-filter: blur(18px);
}

.composer input {
  height: 50px;
  border-color: rgba(156, 168, 204, 0.17);
  border-radius: 999px;
  background: rgba(28, 35, 75, 0.84);
  color: #fff;
}

.composer input:focus,
.modal input:focus,
.modal textarea:focus,
.login-card input:focus,
.login-card textarea:focus,
.invite-row select:focus {
  border-color: rgba(29, 217, 255, 0.66);
  background: rgba(22, 30, 74, 0.96);
  box-shadow: 0 0 0 3px rgba(29, 217, 255, 0.08);
}

.send-button,
.primary-button {
  border-radius: 8px;
  background: linear-gradient(135deg, #18d9ff, #3665ff 48%, #913cff);
  color: #fff;
  box-shadow: 0 14px 30px rgba(76, 78, 255, 0.32);
}

.send-button {
  display: grid;
  width: 54px;
  min-height: 50px;
  place-items: center;
  border-radius: 999px;
  padding: 0;
  font-size: 22px;
}

.send-button:hover,
.primary-button:hover {
  background: linear-gradient(135deg, #35e0ff, #4d74ff 46%, #a657ff);
}

.icon-button.is-recording {
  border-color: rgba(255, 95, 147, 0.78);
  background: linear-gradient(135deg, rgba(255, 95, 147, 0.24), rgba(154, 61, 255, 0.25));
  color: #ffd5e4;
  box-shadow: 0 0 0 4px rgba(255, 95, 147, 0.1), 0 12px 30px rgba(255, 95, 147, 0.2);
}

.reply-bar {
  border-color: rgba(29, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(19, 25, 62, 0.92);
}

.reply-bar__line {
  background: linear-gradient(180deg, #1dd9ff, #9a3dff);
}

.details {
  border-left-color: var(--line);
  background:
    linear-gradient(180deg, rgba(14, 19, 49, 0.98), rgba(7, 11, 33, 0.98)),
    var(--soft);
}

.details__card,
.settings-section,
.security-tile,
.report-row,
.file-row,
.switch-row,
.user-row,
.check-row {
  border-color: rgba(156, 168, 204, 0.14);
  border-radius: 8px;
  background: rgba(17, 23, 58, 0.74);
  color: var(--ink);
  box-shadow: none;
}

.details__card p,
.details__section small,
.member span,
.session-row small,
.user-row small,
.check-row small,
.security-hint,
.security-tile small,
.settings-avatar__actions,
.field-title {
  color: rgba(197, 204, 235, 0.72);
}

.details__section h3,
.settings-section h3,
.security-tile strong,
.member__main strong,
.report-row strong,
.file-row strong {
  color: #fff;
}

.member,
.session-row {
  border-bottom-color: rgba(156, 168, 204, 0.12);
}

.invite-row select,
.admin-grid select {
  border-color: rgba(156, 168, 204, 0.17);
  border-radius: 8px;
  background: rgba(17, 23, 58, 0.9);
  color: var(--ink);
}

.mini-button,
.upload-button {
  border-color: rgba(29, 217, 255, 0.28);
  border-radius: 8px;
  background: rgba(20, 27, 65, 0.92);
  color: #9beeff;
}

.mini-button:hover,
.upload-button:hover {
  border-color: rgba(29, 217, 255, 0.62);
  background: rgba(29, 217, 255, 0.12);
}

.text-button {
  color: #95efff;
}

.text-button.danger,
.mini-button.danger {
  color: #ff8caf;
}

.modal,
.login-modal {
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.login-modal::backdrop,
.modal::backdrop {
  background: rgba(2, 4, 16, 0.72);
  backdrop-filter: blur(8px);
}

.login-card,
.modal__content {
  border: 1px solid rgba(156, 168, 204, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 22, 57, 0.98), rgba(8, 12, 35, 0.98)),
    var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.login-card h1,
.modal__header h2 {
  color: #fff;
}

.login-card label,
.modal label,
.admin-grid label {
  color: rgba(208, 216, 248, 0.82);
}

.login-card input,
.modal input,
.modal textarea,
.login-card textarea {
  border-color: rgba(156, 168, 204, 0.16);
  border-radius: 8px;
  background: rgba(17, 23, 58, 0.88);
}

input[type="color"] {
  overflow: hidden;
  background: rgba(17, 23, 58, 0.88);
}

.password-meter {
  background: rgba(255, 255, 255, 0.08);
}

.password-meter span {
  background: linear-gradient(90deg, #ff5f93, #ffd166);
}

.password-meter[data-score="6"] span {
  background: linear-gradient(90deg, #1ee69f, #1dd9ff);
}

.security-tile code {
  background: rgba(5, 8, 27, 0.7);
  color: #95efff;
}

.key-fingerprint {
  color: #8cdfff;
}

.key-warning {
  border-left-color: var(--coral);
}

.user-row:hover,
.check-row:hover {
  border-color: rgba(29, 217, 255, 0.38);
  background: rgba(29, 217, 255, 0.1);
}

.empty-state {
  color: rgba(197, 204, 235, 0.74);
}

.toast {
  border-color: rgba(29, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(13, 18, 49, 0.96);
  color: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.toast span {
  color: rgba(207, 215, 246, 0.76);
}

.mobile-dock {
  display: none;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .details {
    top: 14px;
    right: 14px;
    bottom: 14px;
    border: 1px solid rgba(156, 168, 204, 0.16);
    border-radius: 8px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    background:
      linear-gradient(145deg, rgba(29, 217, 255, 0.08), transparent 28%),
      linear-gradient(245deg, rgba(154, 61, 255, 0.15), transparent 34%),
      #050615;
  }

  .app-shell {
    width: 100vw;
    height: 100dvh;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    grid-template-columns: 1fr;
    background: #050615;
    overflow-x: hidden;
  }

  .sidebar,
  .conversation {
    grid-column: 1;
    grid-row: 1;
    width: 100vw;
    max-width: 100vw;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .conversation {
    transform: translateX(100vw);
  }

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

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

  .sidebar__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    gap: 8px;
    padding: calc(18px + env(safe-area-inset-top)) 18px 16px;
  }

  .brand-lockup--large,
  .brand-lockup--large > div {
    min-width: 0;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 26px;
  }

  .brand-lockup h1,
  .sidebar__header h1 {
    font-size: 35px;
  }

  .brand-tag {
    max-width: 142px;
    margin-top: 6px;
    font-size: 9px;
    letter-spacing: 0.18em;
    overflow-wrap: anywhere;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, 40px);
    width: 84px;
    min-width: 84px;
    max-width: 84px;
    gap: 8px;
  }

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

  .search,
  .tabs {
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
    margin-right: 18px;
    margin-left: 18px;
  }

  .tabs {
    padding-right: 0;
    padding-left: 0;
  }

  .chat-list {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 12px 12px 18px;
  }

  .chat-item {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    min-height: 84px;
  }

  .conversation {
    grid-template-rows: auto 1fr auto auto;
    background:
      linear-gradient(180deg, rgba(5, 8, 27, 0.82), rgba(5, 8, 27, 0.98)),
      radial-gradient(circle at 20% 20%, rgba(29, 217, 255, 0.045) 0 1px, transparent 1px 30px),
      radial-gradient(circle at 80% 55%, rgba(154, 61, 255, 0.052) 0 1px, transparent 1px 28px),
      #070a1f;
  }

  .conversation__header {
    min-height: 76px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
  }

  .conversation__title h2 {
    font-size: 18px;
  }

  .conversation__actions {
    gap: 7px;
  }

  .message-search {
    display: none;
  }

  .messages {
    gap: 12px;
    padding: 18px 14px;
  }

  .message {
    max-width: 88%;
  }

  .message__bubble {
    padding: 12px 14px;
  }

  .message-media {
    width: min(305px, 72vw);
    max-height: 340px;
  }

  .voice-player {
    width: min(260px, 66vw);
  }

  .typing-bar {
    padding: 0 16px 8px;
  }

  .composer {
    grid-template-columns: 46px minmax(0, 1fr) 46px 52px;
    gap: 8px;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .composer input {
    height: 48px;
    padding: 0 14px;
  }

  .send-button {
    width: 52px;
    min-height: 48px;
  }

  .send-button::after {
    content: "";
  }

  .mobile-dock {
    position: fixed;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 14px;
    z-index: 9;
    display: grid;
    width: calc(100vw - 28px);
    right: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    min-height: 72px;
    padding: 8px;
    border: 1px solid rgba(156, 168, 204, 0.18);
    border-radius: 8px;
    background: rgba(14, 19, 49, 0.88);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.46);
    backdrop-filter: blur(18px);
  }

  .app-shell.chat-open .mobile-dock {
    display: none;
  }

  .mobile-dock__item {
    display: grid;
    min-width: 0;
    place-items: center;
    gap: 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(204, 213, 245, 0.76);
    font-weight: 850;
  }

  .mobile-dock__item span {
    font-size: 23px;
    line-height: 1;
  }

  .mobile-dock__item small {
    overflow: hidden;
    max-width: 100%;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-dock__item.is-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(29, 217, 255, 0.18), rgba(124, 77, 255, 0.28));
  }

  .mobile-dock__item--primary {
    color: #fff;
    background: linear-gradient(135deg, #18d9ff, #3665ff 48%, #913cff);
    box-shadow: 0 12px 28px rgba(76, 78, 255, 0.34);
  }

  .details {
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: min(360px, calc(100vw - 20px));
  }

  .settings-panel {
    padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .header-actions {
    max-width: 88px;
  }

  .brand-lockup--large {
    gap: 10px;
  }

  .brand-lockup h1,
  .sidebar__header h1 {
    font-size: 32px;
  }

  .brand-tag {
    max-width: 170px;
  }

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

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

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

  .composer {
    grid-template-columns: 42px minmax(0, 1fr) 42px 48px;
  }

  .send-button {
    width: 48px;
  }
}

/* Nexa Liquid Glass refresh */
:root {
  --glass: rgba(255, 255, 255, 0.085);
  --glass-strong: rgba(255, 255, 255, 0.13);
  --glass-soft: rgba(255, 255, 255, 0.055);
  --glass-line: rgba(255, 255, 255, 0.24);
  --glass-line-soft: rgba(255, 255, 255, 0.13);
  --liquid-cyan: rgba(29, 217, 255, 0.58);
  --liquid-blue: rgba(51, 101, 255, 0.55);
  --liquid-violet: rgba(154, 61, 255, 0.62);
  --liquid-radius: 28px;
  --liquid-radius-sm: 20px;
  --liquid-blur: blur(26px) saturate(155%);
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(28, 213, 255, 0.2), transparent 28%),
    radial-gradient(circle at 82% 20%, rgba(143, 60, 255, 0.22), transparent 30%),
    radial-gradient(circle at 50% 88%, rgba(42, 81, 255, 0.14), transparent 32%),
    linear-gradient(145deg, #030412, #070a1f 52%, #030412);
}

.app-shell {
  border-color: rgba(255, 255, 255, 0.17);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.082), rgba(255, 255, 255, 0.032)),
    rgba(5, 8, 27, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 34px 100px rgba(0, 0, 0, 0.5);
  backdrop-filter: var(--liquid-blur);
}

.sidebar,
.details,
.conversation__header,
.composer,
.mobile-dock,
.login-card,
.modal__content {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.036)),
    rgba(8, 12, 35, 0.62);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
}

.sidebar,
.details {
  border-color: rgba(255, 255, 255, 0.14);
}

.brand-stack {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.brand-logo-wide {
  display: block;
  width: min(256px, 100%);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 34px rgba(65, 93, 255, 0.32));
}

.brand-logo-icon {
  display: block;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: 24px;
  object-fit: cover;
  box-shadow:
    0 18px 45px rgba(61, 81, 255, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.login-card .brand-lockup {
  align-items: center;
}

.brand-lockup h1,
.sidebar__header h1 {
  font-size: 38px;
}

.sidebar__header {
  align-items: center;
}

.header-actions {
  max-width: 112px;
  gap: 10px;
}

.icon-button,
.message-action,
.reaction-button,
.reaction-pill,
.mini-button,
.upload-button,
.tab,
.mobile-dock__item,
.send-button,
.primary-button,
.text-button,
.chat-item,
.search,
.composer input,
.login-card input,
.modal input,
.modal textarea,
.invite-row select,
.admin-grid select,
.details__card,
.settings-section,
.security-tile,
.report-row,
.file-row,
.switch-row,
.user-row,
.check-row,
.day-divider,
.reply-bar,
.toast {
  position: relative;
  overflow: hidden;
}

.icon-button::before,
.message-action::before,
.reaction-button::before,
.reaction-pill::before,
.mini-button::before,
.upload-button::before,
.tab::before,
.mobile-dock__item::before,
.send-button::before,
.primary-button::before,
.chat-item::before,
.search::before,
.details__card::before,
.settings-section::before,
.security-tile::before,
.reply-bar::before,
.toast::before {
  pointer-events: none;
}

.icon-button::before,
.message-action::before,
.reaction-button::before,
.mini-button::before,
.upload-button::before,
.tab::before,
.mobile-dock__item::before,
.send-button::before,
.primary-button::before,
.chat-item::before,
.search::before,
.details__card::before,
.settings-section::before,
.security-tile::before,
.reply-bar::before,
.toast::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 32%),
    radial-gradient(circle at 18% 8%, rgba(29, 217, 255, 0.18), transparent 32%),
    radial-gradient(circle at 88% 92%, rgba(154, 61, 255, 0.2), transparent 36%);
  opacity: 0.58;
  content: "";
}

.icon-button,
.message-action,
.reaction-button,
.reaction-pill,
.mini-button,
.upload-button {
  border-color: var(--glass-line-soft);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.052)),
    rgba(20, 27, 65, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 14px 34px rgba(0, 0, 0, 0.25);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
}

.icon-button:hover,
.icon-button.is-active,
.message-action:hover,
.reaction-button:hover,
.reaction-pill:hover,
.reaction-pill.is-mine,
.mini-button:hover,
.upload-button:hover {
  border-color: rgba(255, 255, 255, 0.36);
  background:
    linear-gradient(135deg, rgba(29, 217, 255, 0.23), rgba(83, 108, 255, 0.22), rgba(154, 61, 255, 0.26)),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 18px 44px rgba(78, 85, 255, 0.3);
}

.search,
.composer input,
.login-card input,
.modal input,
.modal textarea,
.invite-row select,
.admin-grid select {
  border-color: var(--glass-line-soft);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.036)),
    rgba(13, 18, 49, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
}

.login-card input,
.modal input,
.modal textarea,
.invite-row select,
.admin-grid select {
  border-radius: 22px;
}

.search:focus-within,
.composer input:focus,
.modal input:focus,
.modal textarea:focus,
.login-card input:focus,
.login-card textarea:focus,
.invite-row select:focus,
.admin-grid select:focus {
  border-color: rgba(96, 231, 255, 0.58);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.145), rgba(255, 255, 255, 0.045)),
    rgba(17, 25, 68, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.23),
    0 0 0 4px rgba(29, 217, 255, 0.09),
    0 18px 48px rgba(29, 217, 255, 0.08);
}

.tabs {
  gap: 8px;
}

.tab {
  height: 46px;
  border: 1px solid transparent;
  border-radius: 999px;
}

.tab.is-active,
.mobile-dock__item.is-active {
  border-color: rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(29, 217, 255, 0.24), rgba(67, 98, 255, 0.24), rgba(154, 61, 255, 0.29)),
    rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 18px 42px rgba(76, 78, 255, 0.26);
}

.tab.is-active::after {
  right: 22px;
  bottom: -15px;
  left: 22px;
  height: 4px;
  background: linear-gradient(90deg, #1dd9ff, #7f78ff, #c43dff);
}

.chat-item {
  border-color: transparent;
  border-radius: 26px;
}

.chat-item:hover,
.chat-item.is-active {
  border-color: rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.044)),
    rgba(18, 24, 62, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 18px 50px rgba(0, 0, 0, 0.22);
}

.chat-item.is-active {
  box-shadow:
    inset 4px 0 0 rgba(95, 221, 255, 0.82),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 18px 50px rgba(76, 78, 255, 0.23);
}

.badge {
  background:
    linear-gradient(135deg, #28dcff, #5d66ff 48%, #b43dff);
  box-shadow: 0 10px 28px rgba(124, 77, 255, 0.48);
}

.conversation__header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 18px 60px rgba(0, 0, 0, 0.28);
}

.message__bubble {
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.045)),
    rgba(28, 35, 79, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 18px 46px rgba(0, 0, 0, 0.3);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
}

.message.is-me .message__bubble {
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(135deg, rgba(29, 217, 255, 0.92), rgba(58, 98, 255, 0.92) 45%, rgba(154, 61, 255, 0.94)),
    rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    0 22px 54px rgba(72, 78, 255, 0.36);
}

.message__reply,
.reply-bar,
.details__card,
.settings-section,
.security-tile,
.report-row,
.file-row,
.switch-row,
.user-row,
.check-row,
.toast {
  border-color: var(--glass-line-soft);
  border-radius: var(--liquid-radius-sm);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.038)),
    rgba(15, 21, 56, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 16px 42px rgba(0, 0, 0, 0.2);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
}

.message-media,
.avatar,
.avatar img {
  border-radius: 24px;
}

.avatar {
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 14px 36px rgba(75, 79, 255, 0.32);
}

.send-button,
.primary-button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(38, 220, 255, 0.95), rgba(58, 100, 255, 0.94) 46%, rgba(160, 61, 255, 0.96)),
    rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 18px 42px rgba(88, 91, 255, 0.36);
}

.primary-button {
  min-height: 48px;
}

.primary-button--compact {
  min-height: 40px;
}

.send-button:hover,
.primary-button:hover {
  filter: brightness(1.08) saturate(1.06);
  transform: translateY(-1px);
}

.mobile-dock {
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05)),
    rgba(8, 12, 35, 0.64);
}

.mobile-dock__item {
  border-radius: 22px;
}

.mobile-dock__item--primary {
  background:
    linear-gradient(135deg, rgba(38, 220, 255, 0.94), rgba(58, 100, 255, 0.93) 45%, rgba(160, 61, 255, 0.96));
}

.login-modal,
.modal {
  border-radius: 30px;
}

.login-card,
.modal__content {
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 30px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar,
  .details,
  .conversation__header,
  .composer,
  .mobile-dock,
  .login-card,
  .modal__content,
  .icon-button,
  .message__bubble,
  .search,
  .composer input {
    background-color: rgba(12, 18, 50, 0.94);
  }
}

@media (max-width: 760px) {
  .app-shell {
    border-radius: 0;
  }

  .sidebar__header {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .brand-logo-wide {
    width: min(224px, 100%);
  }

  .brand-logo-icon {
    width: 62px;
    height: 62px;
    border-radius: 22px;
  }

  .header-actions {
    grid-template-columns: repeat(2, 42px);
    width: 88px;
    min-width: 88px;
    max-width: 88px;
  }

  .chat-item {
    border-radius: 24px;
  }

  .conversation__header {
    border-bottom-right-radius: 28px;
    border-bottom-left-radius: 28px;
  }

  .message__bubble {
    border-radius: 24px;
  }
}

@media (max-width: 430px) {
  .brand-logo-wide {
    width: min(205px, 100%);
  }
}

/* Fixed adaptive viewport polish */
html,
body {
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
}

button,
input,
textarea,
select,
a {
  touch-action: manipulation;
}

input,
textarea,
select {
  font-size: 16px;
}

.app-shell {
  width: min(1480px, calc(100dvw - 28px));
  height: min(940px, calc(100dvh - 28px));
  max-width: calc(100dvw - 28px);
  max-height: calc(100dvh - 28px);
}

.sidebar,
.conversation,
.details {
  min-height: 0;
}

.sidebar__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 98px;
}

.header-actions {
  display: grid;
  grid-template-columns: repeat(2, 44px);
  width: 98px;
  min-width: 98px;
  max-width: 98px;
}

.brand-stack {
  overflow: hidden;
}

.brand-logo-wide {
  width: min(238px, 100%);
  max-height: 96px;
}

.modal,
.login-modal {
  max-height: calc(100dvh - 24px);
}

.settings-modal {
  max-height: calc(100dvh - 24px);
}

.modal__content,
.login-card {
  max-height: calc(100dvh - 24px);
  overflow: auto;
}

.ios-guide-modal {
  width: min(520px, calc(100dvw - 28px));
}

.ios-guide {
  gap: 18px;
}

.ios-guide__title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.ios-guide__title h2 {
  font-size: 20px;
}

.ios-guide__icon {
  width: 56px;
  height: 56px;
  border-radius: 20px;
}

.ios-guide__steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ios-guide__steps li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--glass-line-soft);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.038)),
    rgba(13, 18, 49, 0.58);
}

.ios-guide__steps span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(38, 220, 255, 0.92), rgba(154, 61, 255, 0.94));
  color: #fff;
  font-weight: 900;
}

.ios-guide__steps p {
  color: rgba(225, 231, 255, 0.86);
  font-size: 14px;
  line-height: 1.4;
}

.ios-guide__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, auto);
  gap: 10px;
  align-items: center;
}

.send-button {
  display: inline-grid;
  place-items: center;
  color: #fff;
}

.send-button span {
  position: relative;
  z-index: 1;
  display: inline-grid !important;
  place-items: center;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  transform: translateX(1px);
}

.send-button::after {
  content: none !important;
}

@media (max-width: 760px) {
  html,
  body {
    position: fixed;
    inset: 0;
  }

  .app-shell {
    width: 100dvw;
    height: 100dvh;
    max-width: 100dvw;
    max-height: 100dvh;
    min-height: 100dvh;
  }

  .sidebar,
  .conversation {
    width: 100dvw;
    max-width: 100dvw;
    min-height: 100dvh;
    max-height: 100dvh;
  }

  .sidebar__header {
    grid-template-columns: minmax(0, 1fr) 88px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .header-actions {
    grid-template-columns: repeat(2, 40px);
    width: 88px;
    min-width: 88px;
    max-width: 88px;
  }

  .brand-logo-wide {
    width: min(216px, calc(100dvw - 124px));
    max-height: 86px;
  }

  .search,
  .tabs {
    width: calc(100dvw - 28px);
    max-width: calc(100dvw - 28px);
    margin-right: 14px;
    margin-left: 14px;
  }

  .chat-list {
    width: 100dvw;
    max-width: 100dvw;
    padding-right: 10px;
    padding-left: 10px;
  }

  .chat-item {
    width: calc(100dvw - 20px);
    max-width: calc(100dvw - 20px);
  }

  .conversation__header {
    display: grid;
    grid-template-columns: 40px 54px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .conversation__actions {
    min-width: 86px;
  }

  .messages {
    min-height: 0;
    padding-bottom: 16px;
  }

  .composer {
    grid-template-columns: 42px minmax(0, 1fr) 42px 48px;
    width: 100dvw;
    max-width: 100dvw;
    padding-right: 10px;
    padding-left: 10px;
  }

  .mobile-dock {
    right: auto;
    left: 10px;
    width: calc(100dvw - 20px);
    min-height: 70px;
  }

  .modal,
  .login-modal {
    width: min(430px, calc(100dvw - 20px));
    max-height: calc(100dvh - 20px);
  }

  .modal__content,
  .login-card {
    max-height: calc(100dvh - 20px);
    padding: 20px;
  }
}

@media (max-width: 390px) {
  .brand-logo-wide {
    width: min(188px, calc(100dvw - 116px));
  }

  .sidebar__header {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .header-actions {
    grid-template-columns: repeat(2, 38px);
    width: 84px;
    min-width: 84px;
    max-width: 84px;
  }

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

  .chat-item {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 78px;
    padding: 10px 8px;
  }

  .chat-meta {
    min-width: 36px;
  }

  .composer {
    grid-template-columns: 40px minmax(0, 1fr) 40px 46px;
    gap: 6px;
  }

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

  .send-button {
    width: 46px;
  }

  .mobile-dock__item small {
    font-size: 10px;
  }

  .ios-guide__actions {
    grid-template-columns: 1fr;
  }
}
