:root {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #262a30;
  background: #f4f4f4;
  color-scheme: light;
  --soft: #eee;
  --muted: #878e98;
  --line: #e9e9e9;
  --accent: #ff9f0a;
  --read: #448fca;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.4;
}
button,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #448fca;
  outline-offset: 3px;
}
button {
  border: 0;
}
svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.hidden {
  display: none !important;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 7px;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
}
.icon-button:hover {
  background: #00000007;
  color: #262a30;
}
.text-button {
  background: none;
  padding: 6px 0;
  color: #626974;
  font-size: 13px;
}
.text-button:hover {
  text-decoration: underline;
}
.primary,
.secondary,
.danger-button {
  padding: 11px 17px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}
.primary {
  color: #fff;
  background: #262a30;
}
.secondary {
  background: #eee;
  color: #414750;
}
.danger-button {
  background: #fff0ee;
  color: #c53c36;
}
.wide {
  display: block;
  width: 100%;
  margin-top: 12px;
}
.status,
.connection {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #737b87;
  font-size: 13px;
}
.status i,
.connection i {
  width: 7px;
  height: 7px;
  display: inline-block;
  background: #a1a7ae;
  border-radius: 50%;
  flex-shrink: 0;
}
.status[data-state='pending'] i,
.connection[data-state='online'] i {
  background: #27834a;
}
.status[data-state='error'] i,
.connection[data-state='offline'] i {
  background: #dc7046;
}
.status[data-state='loading'] i,
.connection[data-state='connecting'] i {
  animation: pulse 1.5s infinite;
}
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background: #f4f4f4;
}
.login-card {
  width: min(420px, 100%);
  padding: 30px 34px 26px;
  border: 1px solid #e7e7e7;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 50px #00000007;
}
.login-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}
.login-heading img {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}
.login-heading h1 {
  font-size: 19px;
  letter-spacing: -0.4px;
  margin: 0 0 4px;
}
.login-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.login-card h2 {
  font-size: 21px;
  text-align: center;
  margin: 26px 0 10px;
}
.login-description {
  font-size: 13px;
  line-height: 1.8;
  color: #7e8590;
  text-align: center;
  margin: 0;
}
.qr-frame {
  position: relative;
  width: 232px;
  height: 232px;
  margin: 23px auto 18px;
  border: 1px solid #ededed;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  overflow: hidden;
}
.qr {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
.qr svg {
  width: 100%;
  height: 100%;
  stroke: none;
  fill: #262a30;
}
.qr-overlay {
  position: absolute;
  inset: 0;
  background: #fffffff2;
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.qr-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px auto 0;
  max-width: 232px;
  color: #9a9fa7;
  font-size: 11px;
}
.login-steps {
  margin: 24px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 11px;
  line-height: 1.8;
  color: #7a828d;
}
.login-steps li {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}
.login-steps li span {
  display: inline-grid;
  place-items: center;
  background: #f1f1f1;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  font-size: 10px;
}
.login-footnote {
  color: #a3a7ae;
  font-size: 11px;
  margin: 20px 0 0;
}
.app {
  height: calc(100vh - 40px);
  height: calc(100dvh - 40px);
  max-width: 1400px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  background: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 28px #00000004;
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #fafafa;
}
.sidebar-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  letter-spacing: -0.5px;
}
.brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.brand span {
  color: #a0a5ad;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 2px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eee;
  border-radius: 9px;
  margin: 0 16px 21px;
  padding: 9px 11px;
  color: #9a9fa7;
}
.search span {
  display: flex;
}
.search svg {
  width: 17px;
  height: 17px;
}
.search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  outline: 0;
  font-size: 12px;
  color: #262a30;
}
.search:focus-within {
  box-shadow: 0 0 0 2px #448fca50;
}
.section-label {
  font-size: 11px;
  color: #999fa8;
  padding: 0 22px 9px;
  display: flex;
  justify-content: space-between;
}
#rooms {
  overflow: auto;
  flex: 1;
  padding: 0 8px 16px;
}
.room {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  text-align: left;
  border-radius: 10px;
  padding: 14px 12px;
  color: inherit;
  margin: 2px 0;
}
.room:hover {
  background: #f0f0f0;
}
.room.active {
  background: #eaeaea;
}
.avatar,
.account-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 13px;
  background: #e6e2dc;
  color: #686155;
  font-weight: 600;
  font-size: 14px;
}
.room:nth-child(3n + 2) .avatar {
  background: #e1e8e5;
  color: #62746a;
}
.room:nth-child(3n) .avatar {
  background: #e4e6ed;
  color: #6b718b;
}
.room-copy {
  flex: 1;
  min-width: 0;
}
.room-line {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}
.room b {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.room time {
  font-size: 10px;
  flex-shrink: 0;
  color: #999fa8;
}
.room small {
  display: block;
  color: #9399a2;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 6px;
}
.room-badge {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff9f0a;
}
.no-results {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 28px 0;
}
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 16px 20px;
}
.account-avatar {
  width: 31px;
  height: 31px;
  font-size: 11px;
  border-radius: 50%;
  background: #e5e5e5;
  color: #6e737c;
}
.sidebar-footer strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.sidebar-footer small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #a0a6ad;
}
.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  flex-shrink: 0;
  padding: 0 25px;
  background: #eee;
  gap: 12px;
}
.chat-identity {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.small-avatar {
  width: 38px;
  height: 38px;
  font-size: 12px;
  border-radius: 11px;
  background: #e0dfdc;
}
.chat-header h2 {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.connection {
  font-size: 11px;
  justify-content: flex-start;
}
.connection i {
  width: 6px;
  height: 6px;
}
.mobile-back {
  display: none;
}
.connection-banner {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  padding: 7px 16px;
  background: #fff7e9;
  color: #946a2b;
  font-size: 12px;
}
.connection-banner button {
  color: inherit;
  white-space: nowrap;
}
.timeline-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.messages {
  width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 22px 30px 28px;
  scrollbar-gutter: stable;
  background: #fff;
}
.chat-welcome {
  height: 100%;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #9ba1a9;
  gap: 10px;
  font-size: 12px;
}
.chat-welcome .avatar {
  margin-bottom: 3px;
  opacity: 0.7;
}
.chat-welcome strong {
  font-size: 15px;
  font-weight: 500;
  color: #767d88;
}
.chat-welcome p {
  margin: 0;
  line-height: 1.7;
}
.chat-day {
  text-align: center;
  margin: 6px 0 26px;
  color: #a5aab1;
  font-size: 10px;
}
.message-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 17px 0 0;
}
.message-row.mine {
  align-items: flex-end;
}
.message-row.grouped {
  margin-top: 6px;
}
.message {
  max-width: min(580px, 82%);
  min-width: 0;
}
.bubble {
  padding: 11px 14px;
  background: #eee;
  border-radius: 13px 13px 13px 4px;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.mine .bubble {
  border-radius: 13px 13px 4px 13px;
}
.grouped .bubble {
  border-radius: 13px;
}
.bubble p {
  white-space: pre-wrap;
  margin: 0;
}
.sender {
  font-size: 10px;
  color: #969da7;
  margin: 0 3px 5px;
}
.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9ca2ab;
  font-size: 10px;
  margin: 6px 3px 0;
}
.mine .message-meta {
  justify-content: flex-end;
}
.delivery.read {
  color: var(--read);
}
.retry-message {
  background: transparent;
  padding: 0;
  color: #c75548;
  font-size: 11px;
}
.failed .bubble {
  box-shadow: inset 0 0 0 1px #d9857b;
}
.message-actions {
  display: flex;
  gap: 10px;
  margin: 6px 3px 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.mine .message-actions {
  justify-content: flex-end;
}
.message-row:hover .message-actions,
.message-row:focus-within .message-actions {
  opacity: 1;
}
.message-actions button {
  background: none;
  padding: 2px 0;
  font-size: 10px;
  color: #8e959f;
}
.message-actions button:hover {
  color: #262a30;
}
.message-actions .danger {
  color: #bf6660;
}
.quoted {
  display: block;
  width: 100%;
  text-align: left;
  border-left: 2px solid #b4b8bf;
  background: #00000005;
  color: #858c96;
  padding: 5px 9px;
  margin: 0 0 8px;
  font-size: 11px;
  border-radius: 0 5px 5px 0;
}
.quoted b {
  display: block;
  font-weight: 500;
  margin-bottom: 2px;
}
.quoted span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.forwarded {
  font-size: 10px;
  color: #9298a1;
  margin-bottom: 4px;
}
.recalled {
  font-size: 12px;
  color: #9a9fa7;
  font-style: normal;
}
.payload + .payload {
  margin-top: 9px;
}
.image-button {
  background: none;
  display: block;
  padding: 0;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
}
.media-preview {
  display: block;
  max-width: 100%;
  width: 260px;
  max-height: 300px;
  object-fit: contain;
  border-radius: 12px;
}
.image-button .media-preview {
  width: auto;
  height: auto;
  max-width: min(260px, 100%);
}
.draft-video {
  width: 180px;
  height: 110px;
  object-fit: contain;
  background: #111;
  border-radius: 9px;
}
video.media-preview { background: #111; min-height: 140px; }
.bubble:has(> .payload > :is(video, .image-button)) {
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.bubble:has(> .payload > :is(video, .image-button)) > .payload:not(:has(> :is(video, .image-button))) {
  padding: 11px 14px;
  background: #eee;
  border-radius: 13px;
}
.file-card,
.contact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  max-width: 260px;
}
.file-card svg {
  color: #878e98;
  width: 30px;
  height: 30px;
}
.file-card b,
.contact-card b {
  display: block;
  font-weight: 500;
  font-size: 12px;
  word-break: break-all;
}
.file-card small,
.contact-card small {
  display: block;
  font-size: 10px;
  color: #969da6;
  margin-top: 4px;
}
.new-messages {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 3px 16px #0001;
  background: #fff;
  border: 1px solid #e7e7e7;
  border-radius: 24px;
  padding: 9px 16px;
  color: #626b77;
  font-size: 12px;
  white-space: nowrap;
}
.drop-hint {
  position: absolute;
  inset: 8px;
  border: 2px dashed #b1b6be;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #ffffffef;
  color: #626b77;
  pointer-events: none;
  font-size: 14px;
}
.composer {
  padding: 16px 24px 12px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: #fff;
}
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.input-row textarea {
  resize: none;
  width: 100%;
  min-height: 46px;
  max-height: 130px;
  line-height: 22px;
  padding: 12px 15px;
  background: #eee;
  border-radius: 14px;
  border: 0;
  color: #262a30;
  font-size: 14px;
  outline: none;
}
.input-row textarea:focus {
  box-shadow: inset 0 0 0 1px #d5d8dc;
}
.input-row textarea::placeholder {
  color: #a2a7ae;
}
.send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #262a30;
  color: #fff;
  margin-bottom: 1px;
}
.send:hover:not(:disabled) {
  background: #40454e;
}
.send svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}
.composer-tools {
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 0 0 10px;
}
.composer-tools .icon-button {
  width: 32px;
  height: 32px;
  padding: 6px;
}
.composer-tools .icon-button.active {
  color: #27834a;
  background: #edf6ef;
}
.composer-actions { display: flex; align-items: center; gap: 10px; overflow-x: auto; min-width: 0; padding: 5px 3px; scrollbar-width: none; }
.composer-actions .icon-button { flex: 0 0 44px; width: 44px; height: 44px; padding: 11px; border: 1px solid #e6e8ec; border-radius: 50%; background: #f7f8fa; box-shadow: 0 2px 8px #00000012; }
.composer-actions .icon-button svg { width: 18px; height: 18px; }
.composer-actions .icon-button.active, .composer-actions .icon-button[aria-expanded="true"] { color: #f59a23; border-color: #f2b55e; background: #fffaf2; }
.keyboard-hint {
  margin-left: 8px;
  font-size: 10px;
  color: #b0b4ba;
}
.character-count {
  margin-left: auto;
  font-size: 10px;
  color: #b0b4ba;
}
.character-count.limit {
  color: #bc6b45;
}
.quote {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f7f7f7;
  border-left: 2px solid #b4b9c0;
  border-radius: 0 7px 7px 0;
  padding: 7px 10px;
  margin: 0 0 12px;
  color: #8a929d;
  font-size: 11px;
  gap: 12px;
}
.quote > div {
  min-width: 0;
}
.quote strong {
  display: block;
  font-weight: 500;
  color: #737b86;
  margin-bottom: 3px;
}
.quote span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quote button {
  width: 26px;
  height: 26px;
  padding: 5px;
}
.composer-error {
  margin: 0 0 10px;
  color: #bf594c;
  font-size: 12px;
  line-height: 1.5;
}
.recording-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #27834a;
  font-size: 12px;
  margin: 0 0 12px;
}
.recording-status i {
  width: 7px;
  height: 7px;
  background: #27834a;
  border-radius: 50%;
  animation: pulse 1s infinite;
}
.recording-status time {
  font-variant-numeric: tabular-nums;
}
.recording-status small {
  font-size: 10px;
  color: #91a498;
}
.recording-status button {
  margin-left: auto;
}
.attachments {
  display: flex;
  gap: 10px;
  overflow: auto;
  padding: 3px 3px 12px;
}
.attachment {
  position: relative;
  flex-shrink: 0;
  background: #eee;
  padding: 9px;
  border-radius: 11px;
  max-width: 280px;
  min-width: 88px;
}
.attachment > img {
  width: 78px;
  height: 68px;
  object-fit: cover;
  border-radius: 7px;
  display: block;
}
.attachment > .remove-attachment {
  position: absolute;
  right: -2px;
  top: -2px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  color: #fff;
  background: #737b87;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 14px;
  padding: 0;
}
.attachment .file-card {
  padding: 9px 4px;
}
.emoji-panel {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  max-width: 340px;
  background: #f7f7f7;
  padding: 8px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.emoji-panel button {
  background: none;
  border-radius: 7px;
  padding: 5px;
  font-size: 22px;
}
.emoji-panel button:hover {
  background: #e8e8e8;
}
.voice-message {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 250px;
  max-width: 100%;
  min-height: 42px;
  flex-wrap: wrap;
}
.voice-message audio {
  display: none;
}
.voice-play {
  display: grid;
  place-items: center;
  background: #262a30;
  color: #fff;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 7px;
}
.voice-play svg {
  width: 19px;
  height: 19px;
  fill: #fff;
  stroke: none;
}
.voice-wave {
  flex: 1;
  min-width: 30px;
  position: relative;
  height: 30px;
}
.voice-bars {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
}
.voice-bars i {
  display: block;
  flex: 1;
  min-width: 1px;
  border-radius: 2px;
  background: #ff9f0a;
}
.voice-bars i.played {
  background: #9a5b00;
}
.voice-wave input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.voice-wave:focus-within {
  outline: 2px solid #448fca;
  outline-offset: 3px;
  border-radius: 4px;
}
.voice-time {
  font-size: 10px;
  color: #8f969f;
  min-width: 29px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.voice-error {
  font-size: 10px;
  color: #bb6556;
  width: 100%;
  padding-left: 43px;
}
.standard-dialog {
  padding: 24px;
  width: min(400px, calc(100vw - 36px));
  border: 1px solid #e7e7e7;
  border-radius: 17px;
  color: #262a30;
  box-shadow: 0 18px 80px #0002;
}
.standard-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.standard-dialog h3 {
  font-size: 17px;
  margin: 0;
}
.standard-dialog p {
  font-size: 13px;
  line-height: 1.7;
  color: #8a929d;
  margin: 16px 0 20px;
}
.standard-dialog label {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  font-size: 12px;
  color: #737b86;
}
.standard-dialog input {
  width: 100%;
  padding: 12px;
  background: #f3f3f3;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  font-size: 13px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
dialog::backdrop {
  background: #24282d66;
  backdrop-filter: blur(3px);
}
.image-dialog {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 45px 24px;
  background: #181a1df5;
}
.image-dialog[open] {
  display: grid;
  place-items: center;
}
.image-dialog img {
  max-width: 100%;
  max-height: calc(100dvh - 90px);
  object-fit: contain;
}
.image-dialog > .icon-button {
  position: absolute;
  top: 14px;
  right: 18px;
  color: #fff;
  background: #ffffff22;
  border-radius: 50%;
}
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #262a30;
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 12px;
  max-width: calc(100vw - 36px);
  z-index: 20;
  box-shadow: 0 4px 18px #0002;
}
@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}
@media (min-width: 1440px) {
  .app {
    margin-top: 28px;
    height: calc(100dvh - 56px);
  }
}
@media (max-width: 1000px) {
  .app {
    margin: 0;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    grid-template-columns: 265px minmax(0, 1fr);
  }
  .messages {
    padding: 20px;
  }
  .composer {
    padding: 14px 18px 10px;
  }
  .keyboard-hint {
    display: none;
  }
}
@media (max-width: 650px) {
  .app {
    display: block;
  }
  .sidebar {
    height: 100%;
  }
  .app.mobile-chat .sidebar {
    display: none;
  }
  .chat {
    display: none;
    height: 100%;
  }
  .app.mobile-chat .chat {
    display: flex;
  }
  .sidebar-header {
    height: 70px;
  }
  .chat-header {
    height: 68px;
    padding: 0 12px;
    gap: 7px;
  }
  .mobile-back {
    display: flex;
    width: 28px;
    padding: 3px;
  }
  .small-avatar {
    width: 34px;
    height: 34px;
  }
  .messages {
    padding: 18px 14px 24px;
  }
  .message {
    max-width: 88%;
  }
  .message-actions {
    opacity: 1;
    gap: 12px;
  }
  .composer {
    padding: 12px 13px max(9px, env(safe-area-inset-bottom));
  }
  .composer-tools {
    gap: 5px;
  }
  .chat-header h2 {
    font-size: 14px;
  }
  .media-preview {
    width: 220px;
    max-height: 240px;
  }
  .voice-message {
    width: 220px;
  }
  .login-card {
    padding: 25px 24px;
  }
  .login-shell {
    padding: 22px 16px;
  }
  .chat-welcome {
    min-height: 100px;
  }
  .chat-day {
    margin-bottom: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-height: 800px) {
  .login-shell {
    padding: 16px;
  }
  .login-card {
    padding-top: 24px;
    padding-bottom: 20px;
  }
  .login-heading {
    padding-bottom: 18px;
  }
  .login-card h2 {
    margin-top: 20px;
  }
  .qr-frame {
    width: 216px;
    height: 216px;
    margin: 16px auto;
  }
  .login-steps {
    margin-top: 18px;
    padding-top: 14px;
  }
  .login-footnote {
    margin-top: 14px;
  }
}

.call-frame { position: fixed; inset: 0; width: 100%; height: 100dvh; border: 0; z-index: 2000; background: #171a20; }
.call-frame[hidden] { display: none; }
.call-sound-permission { position: fixed; left: 50%; top: max(76px, calc(env(safe-area-inset-top) + 60px)); transform: translateX(-50%); z-index: 2001; border: 0; border-radius: 24px; padding: 12px 20px; background: #f6ca52; color: #252a30; font: inherit; cursor: pointer; }

.room-row { position: relative; overflow: hidden; touch-action: pan-y; }
.room-row .room { position: relative; z-index: 1; background: var(--bg, #fff); transition: transform .18s ease; }
.room-row.swiped .room { transform: translateX(-76px); }
.delete-room { position: absolute; inset: 0 0 0 auto; width: 76px; border: 0; background: #e5484d; color: white; font: inherit; cursor: pointer; }
.room-row:focus-within .delete-room:focus { z-index: 2; }
@media (hover: hover) { .room-row:hover:not(.swiped) .room { width: calc(100% - 76px); } }

.room-row .room.active { background: #eaeaea; }
.room-row .room:hover { background: #f0f0f0; }
.room-row:nth-child(3n + 2) .avatar { background: #e8edf5; color: #536480; }
.room-row:nth-child(3n) .avatar { background: #eee9e0; color: #78674d; }

.room-row { margin: 2px 0; border-radius: 10px; }
.room-row .room { margin: 0; }
.delete-room { visibility: hidden; }
.room-row.swiped .delete-room { visibility: visible; }
@media (hover: hover) { .room-row:hover .delete-room { visibility: visible; } }
.translation-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 7px 20px; background: #f5f6f8; font-size: 12px; }
.translation-controls label, #translationChoices { display: inline-flex; align-items: center; gap: 6px; }
#translationChoices[hidden] { display: none; }
.translation-controls select { max-width: 165px; min-height: 30px; border: 1px solid #e1e4e8; border-radius: 6px; background: #fff; color: inherit; font: inherit; }
.translation-controls small { color: #878e98; }
.message-translation { background: #edf3f8; padding: 8px 12px; border-radius: 10px; margin-top: 6px; font-size: 14px; line-height: 1.5; max-width: 100%; overflow-wrap: anywhere; }
.message-translation p { white-space: pre-wrap; margin: 3px 0; }
.message-translation small { color: #68788a; font-size: 11px; }
.message-translation button { padding: 0; border: 0; background: transparent; color: #448fca; font-size: 11px; margin-top: 3px; }
.translation-error { color: #865b54; }
@media (max-width: 650px) { .translation-controls { padding: 6px 12px; gap: 5px; } .translation-controls select { max-width: 115px; } .translation-controls small { display: none; } }

.bubble > p + small, .bubble > small + small { display: block; overflow-wrap: anywhere; }

.room-unread { flex-shrink: 0; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 12px; background: #ff9f0a; color: #fff; font-size: 11px; }
