.messages-view .desktop-note {
  display: none;
}
.messages-view .app {
  width: min(100%, 1040px);
  margin: 0 auto;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 14px calc(82px + env(safe-area-inset-bottom, 0px));
}
.messages-view .topbar {
  flex-shrink: 0;
  height: 68px;
}
.messages-view .nav {
  left: 50%;
  width: min(100%, 1040px);
}
.messenger-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface-ffffff, white);
}
.conversation-sidebar {
  background: var(--surface-fafcf9, #fafcf9);
  border-right: 1px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.contacts-heading {
  height: 65px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}
.contacts-heading strong {
  font-size: 13px;
}
#conversations {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.contact-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 13px 12px;
  text-align: left;
  border-left: 3px solid transparent;
  min-height: 76px;
}
.contact-row.selected {
  background: var(--mint);
  border-left-color: var(--green);
}
.contact-row:hover {
  background: var(--mint);
}
.contact-face {
  position: relative;
  display: block;
  flex-shrink: 0;
}
.contact-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 13px;
  background: var(--surface-fff1e4, #fff1e4);
  color: var(--text-c06a43, #b9552a);
  font-size: 19px;
  font-weight: 700;
}
.contact-avatar.mine {
  background: var(--mint);
  color: var(--deep);
}
html[data-theme="dark"] .contact-avatar:not(.mine) {
  background: #433125;
  color: #ffd2b4;
}
.contact-face .message-unread {
  position: absolute;
  right: -6px;
  top: -5px;
}
.contact-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}
.contact-copy strong {
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.contact-copy small {
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: var(--muted);
}
.contacts-empty {
  padding: 15px;
  font-size: 12px;
  color: var(--muted);
}
.contacts-self {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.conversation-pane {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}
.conversation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  min-height: 68px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-ffffff, white);
}
.conversation-head strong {
  display: block;
  font-size: 15px;
}
.conversation-head small {
  color: var(--muted);
  font-size: 11px;
}
.conversation-head .contact-avatar {
  width: 34px;
  height: 34px;
  font-size: 16px;
  border-radius: 11px;
}
.conversation-pane .dm-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  gap: 0;
  padding: 18px 22px;
  scroll-behavior: auto;
}
.dm-date {
  align-self: center;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  margin: 4px 0 20px;
}
.dm-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
}
.dm-message.is-mine {
  flex-direction: row-reverse;
}
.dm-message > .contact-avatar {
  width: 34px;
  height: 34px;
  font-size: 15px;
  border-radius: 11px;
  margin-top: 19px;
}
.dm-message-body {
  min-width: 0;
  max-width: 78%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.dm-message.is-mine .dm-message-body {
  align-items: flex-end;
}
.dm-message .bubble {
  max-width: 100%;
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.7;
}
.dm-message .bubble.user {
  border-top-right-radius: 4px;
}
.dm-message .bubble.assistant {
  border-top-left-radius: 4px;
}
.dm-sender {
  font-size: 10px;
  color: var(--muted);
  margin: 0 3px 4px;
}
.dm-time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}
.dm-composer {
  padding: 12px 16px;
  background: var(--surface-ffffff, white);
  border-top: 1px solid var(--line);
}
.dm-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}
.dm-compose-row textarea {
  flex: 1;
  min-width: 0;
  resize: vertical;
  min-height: 44px;
  max-height: 110px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.5;
}
.dm-compose-row .primary,
.dm-attach {
  min-height: 44px;
  width: 44px;
  padding: 10px;
  flex-shrink: 0;
  border-radius: 13px;
}
.dm-attach {
  color: var(--muted);
  background: var(--bg);
}
.dm-latest {
  position: absolute;
  bottom: 82px;
  right: 20px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--deep);
  background: var(--surface-ffffff, white);
  font-size: 12px;
  box-shadow: 0 3px 15px #0001;
}
.dm-latest[hidden] {
  display: none;
}
.dm-greeting {
  margin: auto;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.conversation-welcome {
  margin: auto;
  text-align: center;
  max-width: 300px;
  padding: 24px;
}
.conversation-welcome h2 {
  font-size: 18px;
  margin-top: 14px;
}
.conversation-welcome p {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 20px;
  line-height: 1.8;
}
.conversation-symbol {
  display: inline-flex;
  padding: 18px;
  border-radius: 24px;
  background: var(--mint);
  color: var(--deep);
}
.conversation-symbol .icon {
  width: 30px;
  height: 30px;
}
@media (max-width: 700px) {
  .messages-view .app {
    padding-inline: 0;
  }
  .messages-view .topbar {
    padding-inline: 16px;
    height: 60px;
  }
  .messenger-layout {
    grid-template-columns: 72px minmax(0, 1fr);
    border-inline: 0;
    border-radius: 0;
  }
  .contacts-heading {
    justify-content: center;
    padding: 8px;
    height: 61px;
  }
  .contacts-heading strong,
  .contacts-self > span:last-child {
    display: none;
  }
  .contacts-self {
    justify-content: center;
    padding: 12px 6px;
  }
  .contact-row {
    flex-direction: column;
    gap: 6px;
    padding: 12px 4px;
    min-height: 86px;
  }
  .contact-copy {
    width: 100%;
    align-items: center;
  }
  .contact-copy strong {
    max-width: 58px;
    font-size: 10px;
    font-weight: 500;
  }
  .contact-copy small {
    display: none;
  }
  .conversation-head {
    min-height: 61px;
    padding: 10px 12px;
  }
  .conversation-head .contact-avatar {
    display: none;
  }
  .conversation-head strong {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .conversation-pane .dm-list {
    padding: 12px 10px;
  }
  .dm-message {
    gap: 6px;
  }
  .dm-message > .contact-avatar {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 13px;
  }
  .dm-message-body {
    max-width: calc(100% - 35px);
  }
  .dm-composer {
    padding: 10px 8px;
  }
  .dm-compose-row {
    gap: 5px;
  }
  .dm-compose-row .primary,
  .dm-attach {
    width: 36px;
    padding: 7px;
  }
  .dm-compose-row textarea {
    padding: 9px;
  }
  .contacts-empty {
    padding: 12px 7px;
    text-align: center;
    font-size: 10px;
  }
}
