/* ЛК: чат с продавцом справа от сайдбара (референс CRM msg-thread / msg-composer) */
.zp-lk__shell--chat {
  align-items: stretch;
}

.zp-lk__shell--chat .zp-lk__content[hidden] {
  display: none !important;
}

.zp-lk-chat {
  display: flex;
  flex-direction: column;
  min-height: min(720px, calc(100dvh - 140px));
  height: min(720px, calc(100dvh - 140px));
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(36, 22, 74, 0.08);
  overflow: hidden;
  font-family: var(--zp-font-ui, Nunito, sans-serif);
  color: #242424;
}

.zp-lk-chat[hidden] {
  display: none !important;
}

.zp-lk-chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(36, 22, 74, 0.08);
}

.zp-lk-chat__title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: #242424;
}

.zp-lk-chat__close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f0f2f5;
  color: #242424;
  cursor: pointer;
  font-size: 0;
  line-height: 0;
}

.zp-lk-chat__close::before {
  content: "\00D7";
  font-size: 22px;
  line-height: 1;
  color: inherit;
}

.zp-lk-chat__close:hover,
.zp-lk-chat__close:focus-visible {
  background: #6440bf;
  color: #fff;
  outline: none;
}

.zp-lk-chat__thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 18px 12px;
  background: #f7f7f9;
}

.zp-lk-chat__empty {
  margin: 48px 0;
  text-align: center;
  color: #8b8798;
  font-size: 14px;
}

.zp-lk-chat__bubble {
  display: flex;
  flex-direction: column;
  max-width: min(78%, 520px);
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.zp-lk-chat__bubble--out {
  margin-left: auto;
  background: #ece6fb;
}

.zp-lk-chat__bubble--in {
  margin-right: auto;
}

.zp-lk-chat__bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.4;
}

.zp-lk-chat__bubble-time {
  margin-top: 6px;
  font-size: 11px;
  color: #8b8798;
  align-self: flex-end;
}

.zp-lk-chat__files {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.zp-lk-chat__media {
  margin-top: 8px;
}

.zp-lk-chat__media--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.zp-lk-chat__media--grid .zp-lk-chat__att {
  min-width: 0;
}

.zp-lk-chat__att + .zp-lk-chat__att {
  margin-top: 10px;
}

.zp-lk-chat__media--grid .zp-lk-chat__att + .zp-lk-chat__att {
  margin-top: 0;
}

.zp-lk-chat__media-link {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
}

.zp-lk-chat__media-img {
  display: block;
  max-width: min(100%, 220px);
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.05);
}

.zp-lk-chat__media--grid .zp-lk-chat__media-img {
  width: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: 1;
  object-fit: cover;
}

.zp-lk-chat__att-meta,
.zp-lk-chat__att-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.zp-lk-chat__att-name {
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
}

.zp-lk-chat__att-size {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.78;
  white-space: nowrap;
}

.zp-lk-chat__download {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 10px;
  background: #6440bf;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.zp-lk-chat__download:hover,
.zp-lk-chat__download:focus-visible {
  background: #4c3191;
}

.zp-lk-chat__pending {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 8px;
  background: #fff;
}

.zp-lk-chat__pending--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.zp-lk-chat__pending-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zp-lk-chat__pending-item--file {
  grid-column: 1 / -1;
}

.zp-lk-chat__pending-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f2f5;
  aspect-ratio: 1;
  line-height: 0;
}

.zp-lk-chat__pending-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zp-lk-chat__pending-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.72);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.zp-lk-chat__pending-remove::before {
  content: "\00D7";
  font-size: 15px;
  font-weight: 700;
}

.zp-lk-chat__pending-size {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #5c5470;
  text-align: center;
}

.zp-lk-chat__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px 6px 10px;
  border-radius: 999px;
  background: #f0f2f5;
  font-size: 12px;
  color: #5c5470;
}

.zp-lk-chat__chip button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8b8798;
  cursor: pointer;
  font-size: 0;
}

.zp-lk-chat__chip button::before {
  content: "\00D7";
  font-size: 14px;
  line-height: 1;
}

.zp-lk-chat__status {
  margin: 0;
  padding: 0 18px 8px;
  font-size: 13px;
  color: #b42318;
  background: #fff;
}

.zp-lk-chat__status.is-ok {
  color: #027a48;
}

.zp-lk-chat__composer {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 16px 16px;
  background: #fff;
  border-top: 0;
}

.zp-lk-chat__bar {
  display: flex;
  align-items: flex-end;
  gap: 0;
  min-height: 44px;
  padding: 0 6px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
}

.zp-lk-chat__attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0 0 4px;
  border-radius: 999px;
  color: #99a2ab;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.zp-lk-chat__attach:hover,
.zp-lk-chat__attach:focus-within {
  color: #242424;
  background: rgba(148, 163, 184, 0.12);
}

.zp-lk-chat__attach-plus {
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.zp-lk-chat__field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 4px;
  align-self: stretch;
}

.zp-lk-chat__field textarea {
  width: 100%;
  resize: none !important;
  min-height: 40px;
  max-height: 160px;
  margin: 0;
  padding: 10px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #242424;
  font: 400 15px/1.35 var(--zp-font-ui, Nunito, sans-serif);
  box-shadow: none;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.zp-lk-chat__field textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.zp-lk-chat__field textarea:focus {
  outline: none;
}

.zp-lk-chat__field textarea::placeholder {
  color: #a0a5ab;
  opacity: 1;
}

.zp-lk-chat__tools {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  align-self: stretch;
  padding: 0;
}

.zp-lk-chat__send {
  width: 36px;
  height: 36px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #78a0cc;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}

.zp-lk-chat__send::before {
  content: "";
  width: 18px;
  height: 18px;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378a0cc' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13'/%3E%3Cpath d='M22 2 15 22 11 13 2 9 22 2z'/%3E%3C/svg%3E");
}

.zp-lk-chat__send.is-empty {
  color: #6c7885;
  opacity: 0.72;
  cursor: default;
}

.zp-lk-chat__send.is-empty::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7885' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13'/%3E%3Cpath d='M22 2 15 22 11 13 2 9 22 2z'/%3E%3C/svg%3E");
}

.zp-lk-chat__send:not(.is-empty):hover,
.zp-lk-chat__send:not(.is-empty):focus-visible {
  background: rgba(148, 163, 184, 0.12);
  outline: none;
}

body.zp-lk-chat-open .zp-site-chat-launcher {
  display: none !important;
}

@media (max-width: 900px) {
  .zp-lk__shell--chat {
    grid-template-columns: 1fr;
  }

  .zp-lk__shell--chat .zp-lk__aside {
    display: none;
  }

  .zp-lk-chat {
    min-height: calc(100dvh - 120px);
    height: calc(100dvh - 120px);
    border-radius: 16px;
  }
}
