/* Склад БАТ-М — веб-версия. Цвета задаются переменными из js/theme.js (светлая/тёмная тема). */
:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #16191f;
  --muted: #6b7280;
  --border: #e3e5ea;
  --pressed: #eceef2;
  --primary: #2463eb;
  --primary-pressed: #1d50c1;
  --primary-soft: #e6edfd;
  --on-primary: #fff;
  --bubble-own: #dbe6fc;
  --bubble-other: #fff;
  --mention-bg: #c2d4fa;
  --chat-bg: #f4f5f7;
  --danger: #d92d20;
  --warn-bg: #fff4d6;
  --day-bg: rgba(30, 35, 45, 0.08);
  --placeholder: #9aa0aa;
  --icon-muted: #c3c8d0;
  --media-bg: #1f2430;
  --sidebar-w: 380px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
:root.dark {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
/* скрытые элементы скрыты всегда, даже если для них задано display в стилях ниже */
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#app {
  height: 100dvh;
  display: flex;
  overflow: hidden;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
.hidden-input {
  display: none;
}
.boot {
  margin: auto;
  opacity: 0.9;
}
.boot img {
  border-radius: 16px;
}
.icon {
  display: inline-flex;
  line-height: 0;
}

/* ---------- кнопки и поля ---------- */
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.icon-btn:hover {
  background: var(--pressed);
}
.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.icon-btn:focus-visible,
.btn:focus-visible,
.row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.btn {
  border: 0;
  border-radius: 12px;
  height: 46px;
  padding: 0 18px;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn.primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn.primary:hover {
  background: var(--primary-pressed);
}
.btn.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn.danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--border);
}
.btn.block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.field {
  display: block;
  margin-bottom: 14px;
}
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
.input,
.field input {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 14px;
  font-size: 16px;
  outline: none;
}
.input:focus,
.field input:focus {
  border-color: var(--primary);
}
::placeholder {
  color: var(--placeholder);
}
.error {
  color: var(--danger);
  font-size: 14px;
  margin: 0 0 12px;
}
.muted {
  color: var(--muted);
}
.link {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 600;
  padding: 6px 0;
}

/* ---------- вход ---------- */
.login {
  margin: auto;
  width: 100%;
  max-width: 380px;
  padding: 24px;
}
.login .brand {
  text-align: center;
  margin-bottom: 28px;
}
.login .brand img {
  width: 84px;
  height: 84px;
  border-radius: 19px;
}
.login h1 {
  font-size: 26px;
  margin: 14px 0 6px;
}

/* ---------- раскладка: список чатов + переписка ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-width: 0;
}
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--chat-bg);
}
.bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 56px;
  padding: 8px 8px calc(8px) 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.bar h2 {
  font-size: 18px;
  margin: 0;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar .titles {
  flex: 1;
  min-width: 0;
  cursor: default;
}
.bar .titles.clickable {
  cursor: pointer;
}
.bar .sub {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spacer {
  flex: 1;
}
.brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.brand-mini img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.conn {
  background: var(--warn-bg);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 5px;
  flex: none;
}
.list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  position: relative;
  z-index: 1;
}
/* Бледный логотип на фоне списка чатов (цвет берётся из темы, поэтому виден и в светлой, и в тёмной) */
.sidebar {
  position: relative;
}
.sidebar::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 62%;
  width: min(58%, 260px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background-color: var(--text);
  opacity: 0.06;
  -webkit-mask: url('/icons/watermark.png') center / contain no-repeat;
  mask: url('/icons/watermark.png') center / contain no-repeat;
  pointer-events: none;
  z-index: 0;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-bottom: 1px solid transparent;
}
.row:hover {
  background: var(--pressed);
}
.row.active {
  background: var(--primary-soft);
}
.row .info {
  flex: 1;
  min-width: 0;
}
.row .line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row .name {
  flex: 1;
  font-weight: 600;
  font-size: 15.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .time {
  font-size: 12px;
  color: var(--muted);
}
.row .time.hot {
  color: var(--primary);
}
.row .preview {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex: none;
}
.section {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 16px 16px 8px;
}
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  color: var(--muted);
  gap: 10px;
}
.empty .icon {
  color: var(--icon-muted);
}
.empty b {
  color: var(--text);
  font-size: 17px;
}

/* ---------- аватары ---------- */
.avatar {
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  overflow: hidden;
  background: var(--pressed);
  user-select: none;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- переписка ---------- */
.chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}
.messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 0 6px;
  position: relative;
}
.messages-inner {
  max-width: 860px;
  margin: 0 auto;
}
.day {
  text-align: center;
  margin: 10px 0;
}
.day span {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--day-bg);
  padding: 3px 10px;
  border-radius: 10px;
}
.msg {
  display: flex;
  padding: 2px 12px;
  transition: background 0.4s;
}
.msg.own {
  justify-content: flex-end;
}
.msg.flash {
  background: var(--mention-bg);
}
.bubble {
  max-width: min(80%, 560px);
  border-radius: 16px;
  padding: 7px 11px 5px;
  background: var(--bubble-other);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  min-width: 70px;
  overflow-wrap: anywhere;
}
.msg.own .bubble {
  background: var(--bubble-own);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 4px;
}
.bubble.mention {
  border-left: 3px solid var(--primary);
}
.msg.flash .bubble {
  outline: 2px solid var(--primary);
}
.bubble.media {
  padding: 3px 3px 4px;
}
/* документ (Excel, PDF…) */
.bubble.doc {
  min-width: 240px;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 2px;
  color: inherit;
  text-decoration: none;
  border-radius: 10px;
}
a.file-card:hover .file-name {
  text-decoration: underline;
}
a.file-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.file-icon {
  position: relative;
  flex: none;
  width: 42px;
  height: 46px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
}
.file-icon.ext-xlsx,
.file-icon.ext-xls,
.file-icon.ext-csv {
  background: #1d7a46;
}
.file-icon.ext-pdf {
  background: #c2410c;
}
.file-icon b {
  font-size: 9.5px;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-top: 1px;
}
.file-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.file-name {
  font-weight: 600;
  font-size: 14.5px;
  overflow-wrap: anywhere;
}
.file-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.file-dl {
  flex: none;
  color: var(--primary);
}
.bubble.doc .text {
  margin-top: 6px;
}
.bubble .who {
  font-size: 13px;
  font-weight: 650;
  color: var(--primary);
  margin-bottom: 2px;
}
.bubble.media .who,
.bubble.media .text,
.bubble.media .meta {
  padding-left: 7px;
  padding-right: 7px;
}
.bubble .text {
  white-space: pre-wrap;
  font-size: 15.5px;
  line-height: 1.38;
  user-select: text;
}
.bubble.media .text {
  margin-top: 6px;
}
.bubble .mention-link {
  color: var(--primary);
  font-weight: 650;
  cursor: pointer;
}
.bubble .mention-me {
  background: var(--mention-bg);
  border-radius: 4px;
}
.bubble .meta {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: 2px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}
.meta .icon {
  color: var(--muted);
}
.meta .icon.err {
  color: var(--danger);
}
.pending-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 0 16px 6px;
  font-size: 13px;
}
.pending-actions .err {
  color: var(--danger);
}
.pending-actions button {
  border: 0;
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
}
.pending-actions button.retry {
  color: var(--primary);
  font-weight: 600;
}

/* медиа в сообщениях */
.media-cell {
  position: relative;
  overflow: hidden;
  background: var(--media-bg);
  border: 0;
  padding: 0;
  display: block;
  width: 100%;
}
.media-cell img,
.media-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-single {
  width: 300px;
  max-width: 100%;
  border-radius: 12px;
}
.album {
  width: 320px;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  gap: 2px;
}
.album-row {
  display: grid;
  gap: 2px;
}
.play {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: 6px;
  font-size: 12px;
  pointer-events: none;
}
.play .circle {
  width: 50px;
  height: 50px;
  border-radius: 25px;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 3px;
}
.progress {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress .bar-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: var(--primary);
}
.media-failed {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  gap: 4px;
}

/* ---------- поле ввода ---------- */
.composer-wrap {
  flex: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 8px;
  max-width: 860px;
  margin: 0 auto;
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid transparent;
  background: var(--bg);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 16px;
  line-height: 1.35;
  max-height: 160px;
  min-height: 40px;
  outline: none;
}
.composer textarea:focus {
  border-color: var(--border);
}
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
  max-height: 240px;
  overflow-y: auto;
}
.suggest .row.sel {
  background: var(--primary-soft);
}
.latest {
  position: absolute;
  right: 16px;
  bottom: calc(100% + 12px);
  border: 0;
  border-radius: 20px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.drop-hint {
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--primary);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  color: var(--primary);
  font-size: 17px;
  z-index: 5;
  pointer-events: none;
}

/* ---------- поиск ---------- */
.searchbox {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border-radius: 10px;
  padding: 0 10px;
  height: 38px;
  color: var(--muted);
  min-width: 0;
}
.searchbox input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;
  min-width: 0;
}
.hit {
  background: var(--mention-bg);
  font-weight: 700;
  border-radius: 3px;
}
.result .snippet {
  font-size: 14.5px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result .kind {
  font-size: 12.5px;
  color: var(--muted);
}
.results {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
}

/* ---------- панели и окна ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.sheet-overlay {
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: flex-end;
}
.sheet {
  width: 440px;
  max-width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  animation: slide 0.18s ease-out;
}
.sheet.wide {
  width: 560px;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.sheet-body .pad {
  padding: 16px;
}
.card {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 16px;
}
.card .row + .row {
  border-top: 1px solid var(--border);
}
.center {
  text-align: center;
}
.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px 8px;
}
.avatar-edit {
  position: relative;
  border: 0;
  background: none;
  padding: 0;
  border-radius: 50%;
}
.avatar-edit .cam {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 30px;
  height: 30px;
  border-radius: 15px;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}
.seg {
  display: flex;
  background: var(--surface);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin: 0 16px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 9px 4px;
  font-weight: 600;
  font-size: 14px;
}
.seg button.on {
  background: var(--primary);
  color: var(--on-primary);
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 6px;
  padding: 0 12px;
}
.swatch {
  width: 66px;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  padding: 0;
}
.swatch .dot {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.swatch.on .dot {
  border: 3px solid var(--primary);
}
.check {
  width: 24px;
  height: 24px;
  border-radius: 12px;
  border: 2px solid var(--icon-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.check.on {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}
.dialog-overlay {
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 80;
}
.dialog {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.dialog h3 {
  margin: 0 0 8px;
  font-size: 17px;
}
.dialog p {
  margin: 0 0 16px;
  color: var(--muted);
  white-space: pre-wrap;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.dialog-actions .btn {
  height: 40px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #222;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 100;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%);
}
.toast.err {
  background: #b42318;
}

/* ---------- просмотр фото и видео ---------- */
.viewer {
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}
.viewer .stage {
  position: absolute;
  inset: 56px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 60px 60px;
}
.viewer .stage img,
.viewer .stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.viewer .top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  padding-right: 8px;
  color: #fff;
}
.viewer .icon-btn {
  color: #fff;
}
.viewer .icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.viewer .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.viewer .nav.prev {
  left: 8px;
}
.viewer .nav.next {
  right: 8px;
}
.viewer .caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  text-align: center;
  white-space: pre-wrap;
}

/* ---------- телефон: одна колонка ---------- */
.only-mobile {
  display: none;
}
@media (max-width: 859px) {
  .only-mobile {
    display: inline-flex;
  }
  .only-desktop {
    display: none;
  }
  .sidebar {
    width: 100%;
    border-right: 0;
  }
  #app.chat-open .sidebar {
    display: none;
  }
  #app:not(.chat-open) .main {
    display: none;
  }
  .sheet,
  .sheet.wide {
    width: 100%;
    box-shadow: none;
  }
  .sheet-overlay {
    background: transparent;
  }
  .bubble {
    max-width: 86%;
  }
  .viewer .stage {
    padding: 0 0 60px;
  }
  .viewer .nav {
    display: none;
  }
}
@media (min-width: 1400px) {
  :root {
    --sidebar-w: 420px;
  }
}
@keyframes slide {
  from {
    transform: translateX(30px);
    opacity: 0.6;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sheet {
    animation: none;
  }
  .msg {
    transition: none;
  }
}

/* ---------- меню действий ---------- */
.dialog.menu {
  padding: 8px;
  max-width: 340px;
}
.dialog.menu h3 {
  padding: 10px 12px 2px;
  margin: 0;
}
.dialog.menu p {
  padding: 2px 12px 6px;
  margin: 0;
  font-size: 13px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  text-align: left;
  padding: 12px;
  border-radius: 10px;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--pressed);
  outline: none;
}
.menu-item .icon {
  color: var(--muted);
}
.menu-item.danger,
.menu-item.danger .icon {
  color: var(--danger);
}
.menu-item.cancel {
  justify-content: center;
  color: var(--muted);
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
}

/* кнопка «⋯» у сообщения (на ПК — при наведении) */
.msg {
  position: relative;
  align-items: center;
  gap: 4px;
}
.msg .msg-more {
  opacity: 0;
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--muted);
}
.msg:hover .msg-more,
.msg .msg-more:focus-visible {
  opacity: 1;
}
@media (pointer: coarse) {
  .msg .msg-more {
    display: none;
  }
}
.msg.own .msg-more {
  order: -1;
}
.bubble .edited {
  font-style: italic;
}

/* исправление сообщения и запрет писать */
.edit-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 0 14px;
  max-width: 860px;
  margin: 0 auto;
}
.edit-bar .icon {
  color: var(--primary);
}
.edit-bar .info {
  flex: 1;
  min-width: 0;
  border-left: 2px solid var(--primary);
  padding-left: 8px;
}
.edit-bar b {
  display: block;
  font-size: 13px;
  color: var(--primary);
}
.edit-bar .preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.muted-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.role-tag {
  font-size: 12px;
  font-weight: 650;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 6px;
  padding: 2px 7px;
  flex: none;
}
.preview.warn {
  color: var(--danger);
}
@media (pointer: coarse) {
  /* долгое нажатие открывает меню сообщения, а не выделение текста */
  .bubble,
  .bubble .text {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}
