.user-app.route-chat {
  background: #eef1f5;
}

.user-app.route-chat .u-main {
  padding-bottom: 0;
}

.user-chat-page {
  height: calc(100vh - 142px);
  min-height: 560px;
}

.user-chat-shell {
  width: min(960px, 100%);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #dce3eb;
  border-radius: 12px;
  background: #f5f6f8;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
}

.user-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #e2e7ed;
  background: #fff;
}

.user-chat-head-person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chat-head-person > span {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #fff;
  background: #0f9f8f;
}

.user-chat-head-person b,
.user-chat-head-person small {
  display: block;
}

.user-chat-head-person b {
  color: #1f3449;
  font-size: 13px;
}

.user-chat-head-person small {
  margin-top: 2px;
  color: #7b8c9c;
  font-size: 9.5px;
}

.user-chat-safe {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6f8294;
  font-size: 9.5px;
}

.user-chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 18px 24px;
  overscroll-behavior: contain;
}

.user-chat-start,
.user-chat-load-more {
  display: block;
  margin: 0 auto 15px;
  color: #8c9baa;
  font-size: 9.5px;
  text-align: center;
}

.user-chat-load-more {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.user-chat-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0;
}

.user-chat-row.own {
  justify-content: flex-end;
}

.user-chat-avatar {
  width: 34px;
  height: 34px;
  display: flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #0f766e;
  background: #dff5f0;
}

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

.user-chat-bubble-wrap {
  max-width: min(72%, 640px);
}

.user-chat-row.own .user-chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-chat-bubble {
  min-width: 72px;
  padding: 10px 12px 7px;
  border: 1px solid #e3e7eb;
  border-radius: 4px 13px 13px 13px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.user-chat-row.own .user-chat-bubble {
  border-color: #b9e7ad;
  border-radius: 13px 4px 13px 13px;
  background: #d9fdd3;
}

.user-chat-text {
  color: #253449;
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.user-chat-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 5px;
  color: #91a0ad;
  font-size: 8.5px;
}

.user-chat-meta button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  color: #98a7b5;
  background: transparent;
  cursor: pointer;
}

.user-chat-meta button:hover {
  color: #dc2626;
}

.user-chat-image {
  max-width: 260px;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: #eef1f5;
  cursor: zoom-in;
}

.user-chat-image img {
  width: 100%;
  min-width: 140px;
  min-height: 90px;
  display: block;
  object-fit: cover;
}

.user-chat-file {
  width: min(320px, 56vw);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  color: #29445d;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.user-chat-file > span:first-child {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #2563eb;
  background: #edf4ff;
}

.user-chat-file b,
.user-chat-file small {
  display: block;
}

.user-chat-file b {
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chat-file small {
  margin-top: 3px;
  color: #7d8fa0;
  font-size: 9px;
}

.user-chat-uploading {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  color: #0f766e;
  background: #f0fbf8;
  font-size: 10px;
}

.user-chat-uploading[hidden] {
  display: none;
}

.user-chat-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  padding: 11px 14px;
  border-top: 1px solid #e0e5eb;
  background: #fff;
}

.user-chat-tools {
  display: flex;
  gap: 2px;
  padding-bottom: 3px;
}

.user-chat-tools .icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
}

.user-chat-tool-label {
  display: none;
}

.user-chat-composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  padding: 10px 11px;
  border: 1px solid #d9e1e9;
  border-radius: 8px;
  color: #253449;
  background: #f8fafc;
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
  outline: 0;
}

.user-chat-composer textarea:focus {
  border-color: #65c9bd;
  background: #fff;
}

.user-chat-send {
  min-width: 88px;
  min-height: 42px;
}

@media (max-width: 760px) {
  .user-app.route-chat .u-main {
    padding: 0 !important;
  }

  .user-chat-page {
    height: calc(100vh - 128px);
    min-height: 420px;
  }

  .user-chat-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .user-chat-head {
    padding: 10px 12px;
  }

  .user-chat-messages {
    padding: 12px 10px 18px;
  }

  .user-chat-bubble-wrap {
    max-width: 78%;
  }

  .user-chat-file {
    width: min(260px, 60vw);
  }

  .user-chat-composer {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px 9px;
  }

  .user-chat-tools {
    grid-column: 1 / -1;
    align-items: center;
    gap: 8px;
    padding-bottom: 0;
  }

  .user-chat-tools .icon-btn {
    width: 84px;
    height: 46px;
    min-width: 84px;
    flex: 0 0 84px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #d8e2ef;
    border-radius: 10px;
    color: #2563eb;
    background: #f8fbff;
    font-size: 12px;
    font-weight: 800;
  }

  .user-chat-tools .icon-btn svg {
    width: 20px;
    height: 20px;
  }

  .user-chat-tool-label {
    display: inline;
  }

  .user-chat-composer textarea {
    min-height: 38px;
  }

  .user-chat-send {
    min-width: 70px;
  }
}
