@charset "UTF-8";
/**
 * Главная: две колонки — слева 25% серая, справа светло-серая #eeeeee
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #eeeeee;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: #1a1a1a;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.chat-app {
  display: grid;
  grid-template-columns: 25% 1fr;
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "left right";
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
}

.chat-col--left {
  grid-area: left;
  min-width: 0;
  background: #c5ccd4;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-col--right {
  grid-area: right;
  min-width: 0;
  background: #eeeeee;
}

/* Правая колонка: переписка и ввод внизу */
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.chat-main-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  height: 100%;
}

.chat-main-view[hidden] {
  display: none !important;
}

.chat-thread-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-thread-placeholder {
  margin: 0;
  padding: 24px 20px;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.45;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.chat-thread-loading {
  margin: 0;
  padding: 8px 0;
  font-size: 14px;
  color: #6b7280;
}

.chat-thread-loading--older {
  padding: 6px 0 10px;
  text-align: center;
  font-size: 13px;
}

.chat-thread-error {
  margin: 0;
  padding: 8px 0;
  font-size: 14px;
  color: #b91c1c;
}

.chat-composer {
  flex-shrink: 0;
  overflow: visible;
  padding: 12px 14px 14px;
}

.chat-composer--guest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 14px 14px;
}

.chat-composer-guest-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #4b5563;
}

.chat-composer-guest-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 10px;
  background: #3390ec;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.chat-composer-guest-link:hover {
  background: #2b7fd4;
  color: #fff;
}

.chat-composer-error {
  margin: 0 0 8px;
  padding: 0;
  font-size: 13px;
  line-height: 1.35;
  color: #b91c1c;
}

.chat-composer-edit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(51, 144, 236, 0.08);
  border: 1px solid rgba(51, 144, 236, 0.25);
}

.chat-composer-edit-bar .composer-format-toolbar {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-composer-edit-bar .chat-composer-edit-cancel {
  margin-left: auto;
}

.chat-composer-edit-bar[hidden] {
  display: none;
}

.chat-composer-edit-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e40af;
}

.chat-composer-edit-cancel {
  flex-shrink: 0;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
}

.chat-composer-edit-cancel:hover {
  background: rgba(0, 0, 0, 0.06);
}

.chat-composer--editing .chat-composer-box {
  border-color: rgba(51, 144, 236, 0.45);
  box-shadow: 0 0 0 1px rgba(51, 144, 236, 0.08);
}

.chat-msg {
  margin-bottom: 10px;
  padding: 10px 12px 5px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
}

.chat-msg--search-highlight {
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.55);
  background: rgba(51, 144, 236, 0.08);
  transition: box-shadow 0.2s, background 0.2s;
}

.chat-msg-body {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-msg-body strong,
.chat-msg-caption strong {
  font-weight: 600;
}

.chat-msg-body em,
.chat-msg-caption em {
  font-style: italic;
}

.chat-msg-body code,
.chat-msg-caption code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.chat-comments-parent-body strong {
  font-weight: 600;
}

.chat-comments-parent-body em {
  font-style: italic;
}

.chat-comments-parent-body code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.chat-msg-body a,
.chat-msg-caption a,
.chat-comments-parent-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-msg-body a:hover,
.chat-msg-caption a:hover,
.chat-comments-parent-body a:hover {
  color: #1d4ed8;
}

.chat-msg-body:has(.chat-msg-thumb-wrap),
.chat-msg-body:has(.chat-msg-file-card) {
  white-space: normal;
}

.chat-msg-caption {
  white-space: pre-wrap;
  margin-bottom: 8px;
}

.chat-msg-thumb-wrap {
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
  cursor: zoom-in;
  overflow: hidden;
  max-width: 280px;
  line-height: 0;
}

.chat-msg-thumb-wrap:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 2px;
}

.chat-msg-thumb {
  display: block;
  width: 100%;
  max-height: 220px;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

.chat-msg-video-thumb-inner {
  position: relative;
  display: block;
  max-width: 280px;
  line-height: 0;
}

.chat-msg-thumb-video {
  display: block;
  width: 100%;
  max-height: 220px;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 10px;
}

.chat-msg-video-thumb-wrap {
  cursor: pointer;
}

.chat-msg-video-thumb-wrap:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 2px;
}

.chat-msg-video-play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  line-height: 0;
}

.chat-msg-file-card {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.chat-msg-file-card:hover {
  background: rgba(51, 144, 236, 0.08);
  border-color: rgba(51, 144, 236, 0.35);
}

.chat-msg-file-card:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 2px;
}

.chat-msg-file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1c4ed8;
  font-size: 14px;
  font-weight: 500;
}

.chat-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.chat-lightbox[hidden] {
  display: none !important;
}

.chat-lightbox-backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.88);
  cursor: pointer;
}

.chat-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  pointer-events: none;
}

.chat-lightbox-img {
  display: block;
  max-width: 96vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: auto;
}

.chat-lightbox-video {
  display: block;
  max-width: 96vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  pointer-events: auto;
  background: #0a0a0a;
}

.chat-msg-author {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  margin-bottom: 4px;
  color: #374151;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}

.chat-msg-author-name {
  font-weight: 700;
  font-size: calc(1em + 2pt);
}

.chat-msg-author-date {
  font-weight: 400;
  font-size: 1em;
}

.chat-msg-author-name + .chat-msg-author-date {
  margin-left: 30px;
}

.chat-msg-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px 8px;
  margin-top: 8px;
  min-height: 22px;
}

.chat-msg-util {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  flex-shrink: 0;
  grid-column: 1;
}

.chat-msg-comment-wrap {
  display: inline-flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 0;
  grid-column: 2;
  min-height: 22px;
}

.chat-msg-comment-count {
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  white-space: nowrap;
}

.chat-msg-comment-wrap--today .chat-msg-comment-count {
  color: #dc2626;
}

.chat-msg-comment-wrap--yesterday .chat-msg-comment-count {
  color: #92400e;
}

.chat-msg-comment-wrap--older .chat-msg-comment-count {
  color: #6b7280;
}

.chat-msg-util-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.chat-msg-util-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #4b5563;
}

.chat-msg-util-btn:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 1px;
}

.chat-msg-util-btn svg {
  display: block;
  pointer-events: none;
}

.chat-msg-actions {
  grid-column: 3;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  margin-top: 0;
  justify-self: end;
  width: 100%;
}

.chat-msg-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.chat-msg-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1f2937;
}

.chat-msg-btn:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 1px;
}

.chat-msg-btn svg {
  display: block;
  pointer-events: none;
}

.chat-msg-btn--delete:hover {
  color: #b91c1c;
}

.chat-msg-comment-btn {
  border: none;
  background: transparent;
  padding: 0 6px;
  margin: 0;
  font: inherit;
  font-size: 12px;
  line-height: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  color: #6b7280;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.12s ease, background 0.12s ease;
  vertical-align: bottom;
}

/* Последний комментарий: сегодня — красный, вчера — коричневый, старее — серый */
.chat-msg-comment-btn--today {
  color: #dc2626;
}

.chat-msg-comment-btn--yesterday {
  color: #92400e;
}

.chat-msg-comment-btn--older {
  color: #6b7280;
}

.chat-msg-comment-btn:hover {
  text-decoration: none;
}

.chat-msg-comment-btn:not(.chat-msg-comment-btn--today):not(.chat-msg-comment-btn--yesterday):not(.chat-msg-comment-btn--older):hover {
  color: #3390ec;
  background: rgba(51, 144, 236, 0.08);
}

.chat-msg-comment-btn--today:hover {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.1);
}

.chat-msg-comment-btn--yesterday:hover {
  color: #78350f;
  background: rgba(146, 64, 14, 0.1);
}

.chat-msg-comment-btn--older:hover {
  color: #4b5563;
  background: rgba(107, 114, 128, 0.12);
}

.chat-msg-comment-btn:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 1px;
}

/* Панель комментариев (правая колонка) */
.chat-comments-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  height: 100%;
  background: #eeeeee;
}

.chat-comments-view[hidden] {
  display: none !important;
}

.chat-comments-view-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #e8ecf0;
}

.chat-comments-back {
  border: none;
  background: transparent;
  padding: 6px 8px;
  margin: -6px 0 -6px -6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #3390ec;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.chat-comments-back:hover {
  background: rgba(51, 144, 236, 0.12);
}

.chat-comments-view-title {
  font-weight: 700;
  font-size: 15px;
  color: #374151;
  flex: 1;
  min-width: 0;
}

.chat-comments-view-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-comments-parent {
  flex-shrink: 0;
  padding: 12px 14px 8px;
}

.chat-comments-parent-msg {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.chat-comments-parent-author {
  margin-bottom: 6px;
}

.chat-comments-parent-author.chat-msg-author {
  font-size: 13px;
  color: #374151;
}

.chat-comments-parent-body {
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #1a1a1a;
}

.chat-comments-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 14px 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-comments-loading,
.chat-comments-empty {
  margin: 0;
  padding: 8px 0;
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}

.chat-comments-loading--older {
  padding: 6px 0 8px;
  font-size: 13px;
}

.chat-comment-msg {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 14px;
  line-height: 1.4;
}

.chat-comment-author {
  font-weight: 600;
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 4px;
}

.chat-comment-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #1a1a1a;
}

.chat-comments-thread .chat-msg {
  margin-bottom: 10px;
}

.chat-comments-thread .chat-msg-comment-wrap--spacer {
  min-width: 0;
  pointer-events: none;
}

.chat-comments-composer {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #e8ecf0;
}

.chat-comments-composer--editing .chat-comments-composer-box {
  border-color: rgba(51, 144, 236, 0.45);
  box-shadow: 0 0 0 1px rgba(51, 144, 236, 0.08);
}

.chat-comments-composer-error {
  margin: 0 0 8px;
  font-size: 13px;
  color: #b91c1c;
}

.chat-comments-composer-error[hidden] {
  display: none;
}

.chat-comments-composer-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: visible;
}

.chat-comments-composer-box.chat-comments-composer-box--drag-over {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(239, 246, 255, 0.92);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.chat-comments-composer-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 200px;
  padding: 8px 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  outline: none;
}

.chat-comments-composer--guest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #e8ecf0;
}

.chat-comments-guest-text {
  margin: 0;
  font-size: 14px;
  color: #4b5563;
}

.chat-composer-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: visible;
}

.chat-composer-box.chat-composer-box--drag-over {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(239, 246, 255, 0.92);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.chat-composer-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-composer-toolbar-icons {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.emoji-toolbar-wrap {
  position: relative;
}

.btn-emoji,
.btn-attach {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.06);
  color: #4b5563;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-emoji svg,
.btn-attach svg {
  display: block;
  width: 14px;
  height: 14px;
}

.btn-emoji:hover,
.btn-attach:hover {
  background: rgba(51, 144, 236, 0.18);
  color: #2563eb;
}

.btn-emoji.is-open,
.btn-emoji[aria-expanded="true"] {
  background: rgba(51, 144, 236, 0.22);
  color: #1d4ed8;
}

.btn-emoji:focus-visible,
.btn-attach:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 2px;
}

.btn-attach:disabled {
  opacity: 0.5;
  cursor: wait;
}

.emoji-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  width: min(280px, 72vw);
  max-height: min(220px, 40vh);
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  z-index: 50;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.emoji-panel-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-panel-item {
  margin: 0;
  padding: 0;
  width: 100%;
  aspect-ratio: 1;
  min-height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease;
}

.emoji-panel-item:hover {
  background: rgba(51, 144, 236, 0.12);
}

.emoji-panel-item:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 0;
}

.chat-composer-input-wrap {
  min-width: 0;
  overflow: visible;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Панель форматирования при выделении — над полем ввода */
.composer-format-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.composer-format-toolbar[hidden] {
  display: none !important;
}

.composer-format-toolbar--float {
  order: -1;
  margin: 0 0 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(51, 144, 236, 0.1);
  border: 1px solid rgba(51, 144, 236, 0.22);
}

.composer-format-toolbar .composer-fmt-btn {
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
}

.composer-format-toolbar .composer-fmt-btn:hover {
  background: rgba(51, 144, 236, 0.12);
  border-color: rgba(51, 144, 236, 0.35);
  color: #1d4ed8;
}

.composer-format-toolbar .composer-fmt-btn:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 1px;
}

.chat-comments-composer-input-col {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.chat-comments-composer-input-col .chat-comments-composer-input {
  width: 100%;
}

/* Полоса не показывается; прокрутка колесом и тачпадом сохраняется (overflow-y: auto). */
.chat-composer-input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 8px 8px 4px;
  border: none;
  resize: none;
  min-height: 3.25em;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  color: #1a1a1a;
  background: transparent;
  outline: none;
  box-sizing: border-box;
  vertical-align: top;
}

.chat-composer-input::-webkit-scrollbar {
  display: none;
}

.chat-composer-input::placeholder {
  color: #9ca3af;
}

.btn-send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: #3390ec;
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-send:hover {
  background: #2b7fd4;
}

.btn-send:active {
  transform: scale(0.96);
}

.btn-send:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 2px;
}

.btn-send svg {
  display: block;
}

/* Верх левой колонки: меню + поиск */
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 10px 10px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.2);
}

.btn-menu {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  color: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn-menu:hover {
  background: rgba(255, 255, 255, 0.75);
}

.btn-menu:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 2px;
}

.search-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 4;
}

.search-content-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  text-align: left;
}

.search-content-results__item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.search-content-results__item:last-child {
  border-bottom: 0;
}

.search-content-results__item:hover,
.search-content-results__item:focus {
  background: rgba(51, 144, 236, 0.08);
  outline: none;
}

.search-content-results__meta {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.search-content-results__snippet {
  display: block;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.35;
  word-break: break-word;
}

.search-content-results__empty {
  margin: 0;
  padding: 12px 14px;
  font-size: 13px;
  color: #6b7280;
}

.search-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 22px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.85);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input::placeholder {
  color: #6b7280;
}

.search-wrap input:focus {
  border-color: #3390ec;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.2);
}

/* Список чатов: аватар, название, превью последнего сообщения */
.sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-list-item {
  margin: 0;
  /* Как у публичных плашек: одинаковые отступы слева/справа у всех чатов */
  padding: 4px 8px 4px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.sidebar-row.sidebar-row--public {
  box-sizing: border-box;
  border: 2px solid #3390ec;
  border-radius: 8px;
}

.sidebar-row.sidebar-row--public:hover {
  border-color: #2b7fd4;
}

.sidebar-row.sidebar-row--public.is-active {
  border-color: #1565c0;
}

/* Публичные чаты админа (auser_*) — обводка вокруг строки с кнопкой удаления */
.sidebar-row-wrap.sidebar-row-wrap--public {
  box-sizing: border-box;
  border: 2px solid #3390ec;
  border-radius: 8px;
  overflow: hidden;
}

.sidebar-row-wrap.sidebar-row-wrap--public:hover {
  border-color: #2b7fd4;
}

.sidebar-row-wrap.sidebar-row-wrap--public:has(.sidebar-row.is-active) {
  border-color: #1565c0;
}

.sidebar-row-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.sidebar-row-wrap .sidebar-row {
  flex: 1;
  min-width: 0;
  width: auto;
}

.sidebar-row-delete-chat {
  flex-shrink: 0;
  width: 40px;
  min-height: 56px;
  padding: 0;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  color: #c62828;
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.sidebar-row-delete-chat:hover {
  background: #ffebee;
  color: #b71c1c;
}

.sidebar-row-delete-chat:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: -2px;
}

.sidebar-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 10px 8px 8px;
  border: none;
  background: #fff;
  color: inherit;
  text-align: left;
  transition: background 0.12s ease;
}

.sidebar-row:hover {
  background: #f0f4f8;
}

.sidebar-row.is-active {
  background: #9ec9f2;
  box-shadow: none;
}

.sidebar-row.is-active:hover {
  background: #92c0ee;
}

.sidebar-row:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: -2px;
}

.sidebar-row-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(80, 100, 120, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-row-avatar-ph {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  line-height: 1;
}

.sidebar-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-row-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
  color: #1a1a1a;
  word-wrap: break-word;
}

.sidebar-row-preview {
  font-size: 13px;
  line-height: 1.3;
  color: #5c6570;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Пересылка: выбор чата */
.forward-popover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 35, 0.45);
  z-index: 1002;
}

.forward-popover-backdrop[hidden] {
  display: none !important;
}

.forward-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100vw - 32px));
  max-height: min(70vh, 420px);
  display: flex;
  flex-direction: column;
  z-index: 1003;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.forward-popover[hidden] {
  display: none !important;
}

.forward-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.forward-popover-title {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
}

.forward-popover-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease;
}

.forward-popover-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1f2937;
}

.forward-popover-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.forward-popover-list li {
  margin: 0;
}

.forward-popover-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.12s ease;
}

.forward-popover-item:hover {
  background: rgba(51, 144, 236, 0.1);
}

.forward-popover-empty {
  padding: 16px 12px;
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}

/* Панель меню */
.menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 35, 0.4);
  z-index: 1000;
}

.menu-backdrop.is-open {
  display: block;
}

.menu-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: min(280px, 88vw);
  height: 100%;
  max-height: 100dvh;
  background: #e8ecf0;
  z-index: 1001;
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.18);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.menu-panel.is-open {
  transform: translateX(0);
}

.menu-panel-title {
  padding: 18px 16px 12px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c6570;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.menu-panel-user {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: #1a1a1a;
  line-height: 1.3;
  word-wrap: break-word;
}

.menu-panel-nav {
  padding: 8px 0;
}

.menu-panel-nav a {
  display: block;
  padding: 14px 18px;
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: background 0.12s;
}

.menu-panel-nav a:hover {
  background: rgba(255, 255, 255, 0.6);
}

.menu-panel-nav a:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: -2px;
}

.menu-panel-nav-btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: transparent;
  color: #1a1a1a;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  box-sizing: border-box;
}

a.menu-panel-nav-btn {
  -webkit-tap-highlight-color: transparent;
}

.menu-panel-nav-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.menu-panel-nav-btn:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: -2px;
}

.menu-panel-hint {
  margin: 0 18px 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #6b7280;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}

.menu-panel-hint strong {
  font-weight: 600;
  color: #374151;
}

/* Создать чат: выбор пользователя */
.create-chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 35, 0.45);
  z-index: 1004;
}

.create-chat-backdrop[hidden] {
  display: none !important;
}

.create-chat-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 32px));
  max-height: min(75vh, 480px);
  display: flex;
  flex-direction: column;
  z-index: 1005;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.create-chat-panel[hidden] {
  display: none !important;
}

.create-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.create-chat-title {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
}

.create-chat-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease;
}

.create-chat-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1f2937;
}

.create-chat-body {
  padding: 10px 14px 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.create-chat-mode-choice {
  padding-bottom: 4px;
}

.create-chat-type-btn {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid rgba(51, 144, 236, 0.35);
  border-radius: 10px;
  background: rgba(51, 144, 236, 0.08);
  color: #1565c0;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.create-chat-type-btn:hover {
  background: rgba(51, 144, 236, 0.18);
}

.create-chat-type-btn:focus-visible {
  outline: 2px solid #3390ec;
  outline-offset: 2px;
}

.create-chat-mode-note {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.45;
}

.create-chat-back {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  border: none;
  background: none;
  color: #3390ec;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.create-chat-back:hover {
  text-decoration: underline;
  color: #1565c0;
}

.create-chat-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

.create-chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.create-chat-list li {
  margin: 0;
}

.create-chat-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.12s ease;
}

.create-chat-item:hover {
  background: rgba(51, 144, 236, 0.1);
}

.create-chat-item:disabled {
  opacity: 0.6;
  cursor: wait;
}

.create-chat-empty {
  padding: 16px 8px;
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}

.create-chat-loading,
.create-chat-error {
  margin: 8px 0 0;
  font-size: 14px;
}

.create-chat-error {
  color: #b71c1c;
}

@media (max-width: 520px) {
  .chat-app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(120px, auto) 1fr;
    grid-template-areas:
      "left"
      "right";
  }
}
