/* ============================================================
   Журнал — мессенджер на LiveKit
   ============================================================ */
.mlk {
  display: grid; grid-template-columns: minmax(22rem, 0.38fr) 1fr; grid-template-rows: auto 1fr; gap: 1.2rem; min-height: 26rem;
  --mlk-av: calc(2.35rem * 1.15);
  --mlk-av-ic: calc(1.15rem * 1.15);
  --mlk-av-badge: calc(0.55rem * 1.15);
  --mlk-av-online-dot: calc(0.6rem * 1.15);
  --mlk-av-sm: calc(1.8rem * 1.15);
  --mlk-av-fwd: calc(36px * 1.15);
  --mlk-av-invite: calc(2rem * 1.15);
  --mlk-av-incoming: calc(2.6rem * 1.15);
  --mlk-av-saved-ic: calc(18px * 1.15);
}
.mlk-ticker {
  grid-column: 1 / -1; display: none; overflow: hidden; cursor: pointer;
  border: 1px solid oklch(0.560 0.105 42 / 0.35); border-radius: 4px;
  background: var(--accent-wash); color: var(--ink);
}
.mlk-ticker.is-on { display: block; }
.mlk-ticker__track { overflow: hidden; white-space: nowrap; padding: 0.45rem 0; }
.mlk-ticker__text {
  display: inline-block; padding-left: 100%;
  font-family: var(--grotesk); font-size: var(--t-small); line-height: 1.2;
  animation: mlk-ticker-run 18s linear infinite;
}
@keyframes mlk-ticker-run { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.mlk__list { grid-row: 2; border: 1px solid var(--line); border-radius: 4px; padding: 0.5rem; background: var(--paper-raise); align-self: stretch; display: flex; flex-direction: column; max-height: min(36rem, calc(100vh - 12rem)); min-width: 0; }
.mlk__chat { grid-row: 2; border: 1px solid var(--line); border-radius: 4px; background: var(--paper-raise); display: flex; flex-direction: column; align-self: stretch; min-height: 26rem; max-height: min(36rem, calc(100vh - 12rem)); min-width: 0; overflow: hidden; }
.mlk__chat.is-shake { animation: mlk-shake 0.55s ease-in-out; }
@keyframes mlk-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-5px); }
  36% { transform: translateX(5px); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(4px); }
}
.mlk__lhead { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); padding: 0.6rem 0.7rem 0.7rem; }
.mlk__lempty { font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink-faint); padding: 0.6rem 0.7rem; }
.mlk__lempty.is-err { color: var(--accent-deep); }

/* полоска «недавно» — самостоятельный ряд под шапкой кабинета, над белыми
   блоками списка/чата; во всю ширину области сообщений */
.mlk__online {
  /* вне .mlk — свои копии --mlk-av*, иначе var() пустой и фото-аватар раздувается */
  --mlk-av: calc(2.35rem * 1.15);
  --mlk-av-online-dot: calc(0.6rem * 1.15);
  display: none; gap: 0.6rem; align-items: center; overflow-x: auto; scrollbar-width: thin;
  padding: 0.35rem 0.2rem 0.6rem 1.25rem; margin-bottom: 0.15rem;
}
.mlk__online.is-on { display: flex; }
.mlk__online::-webkit-scrollbar { height: 4px; }
.mlk__online::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.mlk-online__label { flex: none; font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin-right: 0.35rem; }
.mlk-online__chip {
  position: relative; flex: none; width: var(--mlk-av); height: var(--mlk-av); padding: 0; border: 0; border-radius: 50%;
  background: none; cursor: pointer; transition: transform 0.15s var(--ease); overflow: hidden;
}
.mlk-online__chip:hover { transform: scale(1.07); }
.mlk-online__av {
  width: var(--mlk-av); height: var(--mlk-av); border-radius: 50%; box-shadow: 0 0 0 1px var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.04em;
}
.mlk-online__dot {
  position: absolute; right: 0.02rem; bottom: 0.02rem; width: var(--mlk-av-online-dot); height: var(--mlk-av-online-dot); border-radius: 50%;
  background: #2e9e6b; border: 2px solid var(--paper); box-shadow: 0 0 0 1px oklch(0.46 0.12 150 / 0.35);
}
/* офлайн — ч/б как на всём журнале; при появлении в сети цвет плавно возвращается */
.mlk-contact.is-offline,
.mlk-online__chip.is-offline,
.mlk-chat.is-offline,
.mlk-contact.is-kicked {
  filter: grayscale(1);
  transition: filter 0.4s var(--ease);
}
.mlk-contact.is-kicked { cursor: default; opacity: 0.72; }
.mlk-contact.is-kicked .mlk-contact__last { color: var(--ink-faint); font-style: italic; }

.mlk-contact {
  width: 100%; display: flex; align-items: center; gap: 0.7rem; text-align: left;
  padding: 0.65rem 0.7rem; background: none; border: none; border-radius: 3px; cursor: pointer;
  transition: background 0.15s var(--ease);
}
.mlk-contact:hover { background: var(--paper-sink); }
.mlk-contact.is-on { background: var(--accent-wash); }
.mlk-contact.has-unread .mlk-contact__name,
.mlk-contact.has-unread .mlk-contact__last { font-weight: 600; color: var(--ink); }
.mlk-contact__av {
  flex: none; width: var(--mlk-av); height: var(--mlk-av); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--paper-raise);
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.04em;
}
.mlk-contact__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.12rem; }
.mlk-contact__top { display: flex; align-items: baseline; gap: 0.45rem; min-width: 0; }
.mlk-contact__name { flex: 1; min-width: 0; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlk-contact__time { flex: none; font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); letter-spacing: 0.02em; }
.mlk-contact__muted { flex: none; display: inline-flex; align-items: center; color: var(--ink-faint); opacity: 0.7; }
.mlk-contact__muted svg { width: 0.8rem; height: 0.8rem; }
.mlk-contact__role { font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlk-contact__badge {
  flex: none; min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.02em;
  background: var(--accent); color: var(--paper-raise);
}

.mlk__empty { margin: auto; padding: 2rem; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink-faint); text-align: center; max-width: 24rem; }

.mlk-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mlk-chat__head { display: flex; align-items: center; gap: 0.7rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.mlk-chat__id { display: flex; flex-direction: column; min-width: 0; }
.mlk-chat__name { font-family: var(--grotesk); font-size: var(--t-body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mlk-chat__status { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.06em; color: var(--ink-faint); margin-top: 0.15rem; }
.mlk-chat__status:empty { display: none; }

.mlk-thread { flex: 1; min-height: 12rem; min-width: 0; overflow-x: hidden; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.mlk-b { position: relative; max-width: 76%; width: max-content; flex-shrink: 0; align-self: flex-start; background: var(--paper-sink); border: 1px solid var(--line); border-radius: var(--radius-md, 16px) var(--radius-md, 16px) var(--radius-md, 16px) calc(var(--radius-btn-sm, 11px) / 2); padding: 0.5rem 0.75rem; overflow: visible; }
/* Кнопка жалобы живёт в ряду действий пузыря (.mlk-b__acts) — рядом с
   «Ответить»/«Редактировать»/«Удалить». Выглядит так же, как соседние иконки. */
.mlk-b__report { display: inline-flex; align-items: center; }
.mlk-b__report .rep-btn--compact {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; height: auto; padding: 0;
  border: 0; background: transparent; color: var(--ink-faint); cursor: pointer;
  transition: color 0.12s var(--ease);
}
.mlk-b__report .rep-btn--compact:hover { color: var(--accent-deep); }
.mlk-b__report .rep-btn--compact .rep-btn__ic { display: inline-flex; width: 0.75rem; height: 0.75rem; }
.mlk-b.is-me { align-self: flex-end; background: var(--accent-wash); border-color: oklch(0.560 0.105 42 / 0.3); border-radius: var(--radius-md, 16px) var(--radius-md, 16px) calc(var(--radius-btn-sm, 11px) / 2) var(--radius-md, 16px); }
.mlk-b__t { display: block; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink); line-height: 1.4; min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.mlk-b__meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem;
  width: 100%; min-width: 0; margin-top: 0.2rem; line-height: 1;
}
.mlk-b__time {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 0.25rem;
  font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint);
  margin-top: 0; line-height: 1; min-width: 0; max-width: 100%;
}
.mlk-rc { display: inline-flex; align-items: center; color: var(--ink-faint); opacity: 0.85; }
.mlk-rc svg { width: 0.85rem; height: 0.85rem; }
.mlk-rc--delivered { opacity: 1; }
.mlk-rc--read { color: var(--accent-deep); opacity: 1; }
.mlk-rc--mini svg { width: 0.72rem; height: 0.72rem; }
.mlk-contact__nudge {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: auto; height: auto; padding: 0; margin-left: auto;
  border: 0; background: transparent; color: var(--ink-faint); cursor: pointer;
  transition: color 0.12s var(--ease);
}
.mlk-contact__nudge:hover:not(:disabled) { color: var(--accent-deep); }
.mlk-contact__nudge:disabled { opacity: 0.35; cursor: default; }
.mlk-contact__nudge .u-ic { display: inline-flex; }
.mlk-contact__nudge svg { width: 0.75rem; height: 0.75rem; }
.mlk-contact__top .mlk-rc--mini { flex: none; margin-right: 0.1rem; }

.mlk-bar { display: flex; gap: 0.5rem; align-items: center; flex: none; padding: 0.45rem 0.75rem 0.5rem; border-top: 1px solid var(--line); }
.mlk-input {
  flex: 1; font-family: var(--grotesk); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 1.1rem;
  padding: 0.6rem 0.9rem; resize: none; overflow-y: hidden; line-height: 1.35;
  min-height: 2.6rem; max-height: 7.5rem;
}
.mlk-input:focus { outline: none; border-color: var(--accent); }
.mlk-send {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--paper-raise); border: none; cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.mlk-send svg { width: 1.1rem; height: 1.1rem; }

/* ---- вложения (файлы в 1:1) ---- */
.mlk-attach {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line-strong); color: var(--ink-soft);
  cursor: pointer; transition: all 0.2s var(--ease);
}
.mlk-attach:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-attach svg { width: 1.2rem; height: 1.2rem; }
.mlk-bar.is-rec .mlk-attach { display: none; }

.mlk-b.is-file { padding: 0.45rem; }
.mlk-file-wrap { display: flex; flex-direction: column; gap: 0.4rem; }
.mlk-file__thumb {
  display: block; max-width: 16rem; max-height: 13rem; width: auto; height: auto;
  border-radius: 6px; border: 1px solid var(--line); object-fit: cover; cursor: pointer; background: var(--paper-sink);
  filter: grayscale(1);
}
.mlk-file {
  display: flex; align-items: center; gap: 0.6rem; min-width: 11rem; max-width: 17rem;
  padding: 0.15rem 0.1rem;
}
.mlk-file__icon {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft);
}
.mlk-file__icon svg { width: 1.15rem; height: 1.15rem; }
.mlk-file__info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.05rem; }
.mlk-file__name {
  font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mlk-file__meta { font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); letter-spacing: 0.02em; }
.mlk-file__dl {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line-strong); color: var(--ink-soft);
  cursor: pointer; transition: all 0.2s var(--ease);
}
.mlk-file__dl:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-file__dl:disabled { opacity: 0.5; cursor: default; }
.mlk-file__dl svg { width: 1rem; height: 1rem; }

/* инлайн-видео в чатах и почте */
.mlk-video { display: flex; flex-direction: column; gap: 0.4rem; max-width: 18rem; }
.mlk-video__frame {
  position: relative; border-radius: 8px; overflow: hidden; background: #000;
  border: 1px solid var(--line); min-height: 8rem; display: flex;
}
.mlk-video__el { display: block; width: 100%; max-height: 15rem; background: #000; }
.mlk-video:not(.is-loaded) .mlk-video__el { display: none; }
.mlk-video__cover {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--paper-sink); border: 0; cursor: pointer;
  transition: background 0.15s var(--ease);
}
.mlk-video.is-loaded .mlk-video__cover { display: none; }
.mlk-video__cover:hover { background: var(--paper); }
.mlk-video__play {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--paper-raise); border: 1px solid var(--line-strong); color: var(--accent-deep);
  box-shadow: 0 2px 10px oklch(0 0 0 / 0.15);
}
.mlk-video__play svg { width: 1.5rem; height: 1.5rem; }
.mlk-video.is-loading .mlk-video__play { opacity: 0.5; }
.mlk-video__note {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0.35rem 0.5rem;
  font-family: var(--mono); font-size: var(--t-micro); color: var(--paper-raise);
  background: oklch(0 0 0 / 0.55); text-align: center;
}
.mlk-video__note:empty { display: none; }
.mlk-video__bar { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.1rem; }
.mlk-video__name {
  flex: 1; min-width: 0; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mlk-video__size { flex: none; font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); letter-spacing: 0.02em; }
.mlk-video__dl {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line-strong); color: var(--ink-soft);
  cursor: pointer; transition: all 0.2s var(--ease);
}
.mlk-video__dl:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-video__dl:disabled { opacity: 0.5; cursor: default; }
.mlk-video__dl svg { width: 1rem; height: 1rem; }

@media (max-width: 720px) {
  .mlk { grid-template-columns: 1fr; min-height: auto; }
  .mlk__list { max-height: none; flex: 1; min-height: min(28rem, calc(100dvh - 11rem)); }
  .mlk__contacts { flex: 1; min-height: 0; overflow-y: auto; }
  .mlk__chat { display: none; min-height: min(36rem, calc(100dvh - 8rem)); max-height: none; }
  .mlk.is-chat .mlk__list { display: none; }
  .mlk.is-chat .mlk__chat { display: flex; }
  /* мобила: полоска «Недавно» не показываем */
  .mlk__online.is-on { display: none; }
  .mlk-thread { max-height: none; flex: 1; min-height: 8rem; }
  .mlk-bar { padding: 0.45rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px)); }
}
.mlk-chat__back {
  display: none;
}
.mlk-chat__back svg { width: 1.1rem; height: 1.1rem; }
.mlk-chat__head-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  padding-right: 0.5rem;
}
.mlk-chat__ident {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  padding: 0;
  flex: 1;
}

/* ============================================================
   Голосовые сообщения + микрофон + панель записи
   ============================================================ */
.mlk-mic {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1px solid var(--line-strong); color: var(--ink-soft); cursor: pointer;
  transition: all 0.15s var(--ease);
}
.mlk-mic:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-mic svg { width: 1.1rem; height: 1.1rem; }
.mlk-mic.is-rec { background: var(--accent); border-color: var(--accent); color: var(--paper-raise); }

.mlk-bar.is-rec .mlk-input, .mlk-bar.is-rec .mlk-send { display: none; }
.mlk-rec { display: none; }
.mlk-bar.is-rec .mlk-rec { display: flex; align-items: center; gap: 0.6rem; flex: 1; padding: 0.2rem 0.1rem 0.2rem 0.5rem; }
.mlk-rec__dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--accent); flex: none; animation: mlk-pulse 1s infinite; }
@keyframes mlk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.mlk-rec__l { font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink-soft); }
.mlk-rec__t { font-family: var(--mono); font-size: var(--t-small); color: var(--ink); margin-left: auto; }
.mlk-rec__cancel, .mlk-rec__send {
  flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.mlk-rec__cancel { background: var(--paper); border: 1px solid var(--line-strong); color: var(--ink-soft); }
.mlk-rec__cancel:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-rec__send { background: var(--accent); border: none; color: var(--paper-raise); }
.mlk-rec__send:hover { background: var(--accent-deep); }
.mlk-rec__cancel svg, .mlk-rec__send svg { width: 1rem; height: 1rem; }

.mlk-contact__dot { flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: transparent; }

.mlk-b.is-voice { padding: 0.45rem 0.65rem; min-width: min(76%, 11rem); }
.mlk-voice { display: flex; align-items: center; gap: 0.55rem; min-width: 0; max-width: 100%; width: 100%; box-sizing: border-box; }
.mlk-voice__play {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--accent); border: none; color: var(--paper-raise);
}
.mlk-b.is-voice:not(.is-me) .mlk-voice__play { background: var(--ink-soft); }
.mlk-voice__play svg { width: 0.95rem; height: 0.95rem; display: block; }
.mlk-voice__wave { flex: 1 1 0; display: flex; align-items: center; gap: 2px; height: 1.6rem; min-width: 2.5rem; overflow: hidden; }
.mlk-voice__bar { flex: 1; min-width: 3px; background: currentColor; opacity: 0.5; border-radius: 1.5px; color: var(--accent); }
.mlk-b.is-voice:not(.is-me) .mlk-voice__bar { color: var(--ink-soft); }
.mlk-voice__time { font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); flex: none; }

/* поиск/компоуз контактов — писать любому по имени или адресу страницы */
.mlk__find { padding: 0.6rem 0.8rem 0.4rem; }
.mlk__search {
  width: 100%; box-sizing: border-box; font-family: var(--grotesk); font-size: 1rem;
  color: var(--ink-faint); padding: 0.5rem 0.7rem; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--paper);
}
.mlk__search:focus { outline: none; border-color: var(--accent); }
.mlk__search::placeholder { color: var(--ink-faint); }
.mlk__contacts { display: flex; flex-direction: column; overflow-y: auto; flex: 1; min-height: 0; }
.mlk__group {
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0.7rem 0.9rem 0.3rem;
}

/* превью последнего сообщения в списке диалогов */
.mlk-contact__last { display: block; font-family: var(--grotesk); font-size: var(--t-micro); color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* от чьего имени писать (личный аккаунт или страница) */
.mlk__compose { padding: 0.7rem 0.8rem 0.65rem; }
.mlk__compose-label { display: block; font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.35rem; }
.mlk__as {
  width: 100%; box-sizing: border-box; font-family: var(--grotesk); font-size: 1rem;
  color: var(--ink-faint); padding: 0.5rem 0.7rem; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--paper);
  height: 34px;
  line-height: 1.35;
}
.mlk__as:focus { outline: none; border-color: var(--accent); }

/* адресная шапка диалога + базовая карточка аккаунта */
.mlk-chat__head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.mlk-chat__ident:hover .mlk-chat__name { color: var(--accent-deep); }
.mlk-chat__sub { display: block; font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mlk-chat__meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex: none;
  min-width: 0;
}
.mlk-chat__open {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.2rem;
  padding: 0 0.65rem;
  margin: 0;
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: var(--paper-raise);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn-sm);
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.15s var(--ease);
}
.mlk-chat__open:hover { border-color: var(--accent); color: var(--accent-deep); }

.mlk-modal { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; background: oklch(0.235 0.012 60 / 0.42); padding: 1rem; }
.mlk-modal > .mlk-rupor-sheet {
  width: min(32rem, 94vw);
  max-height: min(85vh, 32rem);
  overflow-y: auto;
  text-align: left;
  background: var(--paper-raise);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: 0 24px 60px oklch(0.235 0.012 60 / 0.25);
}
.mlk-prof { width: min(360px, 94vw); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px; padding: 1.6rem; text-align: center; box-shadow: 0 24px 60px oklch(0.235 0.012 60 / 0.25); }
.mlk-prof__av { display: inline-grid; place-items: center; width: calc(64px * 1.15); height: calc(64px * 1.15); border-radius: 999px; background: var(--accent-wash); color: var(--accent-deep); font-family: var(--serif); font-size: calc(1.5rem * 1.15); margin-bottom: 0.7rem; }
.mlk-prof__name { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); margin: 0; }
.mlk-prof__sub { display: block; font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); margin-top: 0.2rem; }
.mlk-prof__note { font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink-soft); line-height: 1.5; margin: 1rem 0 1.2rem; }
.mlk-prof__x { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.06em; background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.45rem 1.1rem; cursor: pointer; color: var(--ink-soft); transition: all 0.15s var(--ease); }
.mlk-prof__x:hover { border-color: var(--ink); color: var(--ink); }

/* переключатель исходящего адреса в самой переписке («как я» / «как студия») */
.mlk-chat__aswrap { display: inline-flex; align-items: center; gap: 0.35rem; }
.mlk-chat__aslab { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.mlk-chat__as {
  font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink);
  min-width: 9.5rem; max-width: 13rem; padding: 0.4rem 0.7rem; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--paper); cursor: pointer;
}
.mlk-chat__as:focus { outline: none; border-color: var(--accent); }

/* ===== звонки: кнопки в шапке, оверлей, входящий баннер ===== */
.mlk-chat__actions { display: inline-flex; align-items: center; gap: 0.55rem; flex: none; }
.mlk-chat__menu { position: relative; flex: none; }
.mlk-chat__menu-btn.is-on {
  color: var(--accent-deep);
  border-color: var(--accent);
  background: var(--accent-wash);
}
.mlk-chat__menu-drop {
  display: none;
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 12;
  min-width: 13.5rem;
  max-width: min(18rem, calc(100vw - 1.5rem));
  padding: 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md, 12px);
  background: var(--paper-raise);
  box-shadow: 0 10px 28px oklch(0.2 0.01 60 / 0.12);
}
.mlk-chat__menu-drop.is-on { display: block; }
@media (max-width: 720px) {
  .mlk-chat__menu-drop.is-on {
    z-index: 1320;
  }
}
.mlk-chat__menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: var(--radius-btn-sm, 8px);
  background: none;
  color: var(--ink);
  font-family: var(--grotesk);
  font-size: var(--t-small);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.mlk-chat__menu-item:hover { background: var(--paper-sink); color: var(--accent-deep); }
.mlk-chat__menu-item.is-on { color: var(--accent-deep); background: var(--accent-wash); }
.mlk-chat__menu-item[hidden] { display: none !important; }
.mlk-chat__menu-item--back { display: none; }
.mlk-chat__menu-ic {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--ink-soft);
}
.mlk-chat__menu-ic .u-ic,
.mlk-chat__menu-ic .u-ic svg { width: 100%; height: 100%; display: block; }
.mlk-chat__menu-label { min-width: 0; flex: 1; }
@media (max-width: 720px) {
  .mlk-chat__menu-item--back { display: flex; }
}
.mlk-chat__call {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%;
  background: var(--paper-raise); color: var(--ink-soft); cursor: pointer; transition: all 0.15s var(--ease);
}
.mlk-chat__call:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-chat__call svg { width: 1.1rem; height: 1.1rem; }

/* рупор-обсуждение: без колонки «Темы», шапка с полным заголовком */
.mlk-chat.is-rupor .mlk-chat__head { align-items: flex-start; gap: 0.55rem; padding: 0.7rem 0.85rem; }
.mlk-chat.is-rupor .mlk-chat__head-left { flex: 1; min-width: 0; }
.mlk-chat.is-rupor .mlk-chat__ident { align-items: flex-start; }
.mlk-chat.is-rupor .mlk-chat__id { flex: 1; min-width: 0; }
.mlk-chat.is-rupor .mlk-chat__name {
  white-space: normal; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  line-height: 1.28;
}
.mlk-chat.is-rupor .mlk-chat__meta { flex: none; max-width: 62%; align-items: center; }
.mlk-chat.is-rupor .mlk-chat__actions { flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; max-width: 100%; }
.mlk-chat.is-rupor .mlk-chat__open { margin-top: 0.1rem; }

.mlk-call {
  position: fixed; inset: 0; z-index: 1200; display: flex; flex-direction: column;
  background: #0b0b0d; color: #fff; transition: opacity 0.4s var(--ease);
  height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}
.mlk-call.is-ending { opacity: 0; pointer-events: none; }
.mlk-call__stage { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.mlk-call__remote { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.mlk-call__rv { width: 100%; height: 100%; max-width: none; object-fit: cover; background: #000; }
.mlk-call__avatar {
  width: calc(7.5rem * 1.15); height: calc(7.5rem * 1.15); border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: calc(2.6rem * 1.15); color: #fff; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
}
.mlk-call__local { position: absolute; right: 1rem; bottom: 1rem; width: clamp(6rem, 22vw, 9rem); max-width: none; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,0.5); background: #111; }
.mlk-call__lv { width: 100%; height: 100%; object-fit: cover; }
.mlk-call__local.is-front .mlk-call__lv { transform: scaleX(-1); } /* фронталка — зеркалим; тыловая — нет */
.mlk-call__head { position: absolute; top: 0; left: 0; right: 0; padding: 1.1rem 1.3rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; background: linear-gradient(to bottom, rgba(0,0,0,0.45), transparent); }
.mlk-call__head-txt { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.mlk-call__name { font-family: var(--serif); font-size: 1.3rem; }
.mlk-call__status { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.06em; color: rgba(255,255,255,0.7); }
.mlk-call__pip {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem;
  border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: rgba(255,255,255,0.16); transition: background 0.15s var(--ease);
}
.mlk-call__pip:hover { background: rgba(255,255,255,0.28); }
.mlk-call__pip svg { width: 1.25rem; height: 1.25rem; }
.mlk-call__ctrls { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1.3rem; padding-bottom: calc(1.3rem + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, rgba(0,0,0,0.5), transparent); }
.mlk-call__ctl, .mlk-call__hang {
  display: inline-flex; align-items: center; justify-content: center; width: 3.1rem; height: 3.1rem;
  border-radius: 50%; border: 0; cursor: pointer; color: #fff; transition: all 0.15s var(--ease);
}
.mlk-call__ctl { background: rgba(255,255,255,0.16); }
.mlk-call__ctl:hover { background: rgba(255,255,255,0.26); }
.mlk-call__ctl:disabled { opacity: 0.5; cursor: default; }
.mlk-call__ctl.is-off { background: #fff; color: #111; }
.mlk-call__ctl svg, .mlk-call__hang svg { width: 1.4rem; height: 1.4rem; }
.mlk-call__hang { background: #e0413a; }
.mlk-call__hang:hover { background: #c5352f; }

.mlk-incoming {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 1250;
  display: flex; align-items: center; gap: 1.2rem; padding: 0.8rem 1rem;
  background: var(--paper-raise); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22); max-width: min(92vw, 30rem);
}
.mlk-incoming__who { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.mlk-incoming__av { flex: none; width: var(--mlk-av-incoming); height: var(--mlk-av-incoming); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: var(--t-small); background: var(--accent-wash); color: var(--accent-deep); }
.mlk-incoming__txt { display: flex; flex-direction: column; min-width: 0; }
.mlk-incoming__name { font-family: var(--grotesk); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlk-incoming__sub { font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); }
.mlk-incoming__acts { display: inline-flex; gap: 0.5rem; flex: none; }
.mlk-incoming__ok, .mlk-incoming__no { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.45rem 0.7rem; border-radius: 999px; border: 0; cursor: pointer; font-family: var(--grotesk); font-size: var(--t-small); color: #fff; }
.mlk-incoming__ok { background: #2e9e6b; }
.mlk-incoming__no { background: #e0413a; }
.mlk-incoming__ok svg, .mlk-incoming__no svg { width: 0.95rem; height: 0.95rem; }

.mlk__ltitle { flex: 1; min-width: 0; }
.mlk__newgrp {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper-raise); color: var(--ink); cursor: pointer;
}
.mlk__newgrp:hover { border-color: var(--line-strong); background: var(--accent-wash); }
.mlk__newgrp svg { width: 0.95rem; height: 0.95rem; }
.mlk-contact__gav, .mlk-chat__gav {
  flex: none; width: var(--mlk-av); height: var(--mlk-av); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-wash); color: var(--accent-deep);
  line-height: 0;
}
.mlk-contact__gav .u-ic,
.mlk-chat__gav .u-ic,
.mlk-fwd__gav .u-ic,
.mlk-invite__gav .u-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--mlk-av-ic); height: var(--mlk-av-ic); flex: none; line-height: 0;
}
.mlk-contact__gav .u-ic svg,
.mlk-chat__gav .u-ic svg,
.mlk-fwd__gav .u-ic svg,
.mlk-invite__gav .u-ic svg {
  width: 100%; height: 100%; display: block;
}
.mlk-contact__gav.is-saved .u-ic,
.mlk-chat__gav.is-saved .u-ic { width: var(--mlk-av-saved-ic); height: var(--mlk-av-saved-ic); }
.mlk-b__stack { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; max-width: 100%; }
.mlk-b__who { font-family: var(--mono); font-size: var(--t-micro); color: var(--accent-deep); letter-spacing: 0.02em; }
.mlk-grp__name {
  width: 100%; margin: 0.6rem 0; padding: 0.55rem 0.65rem; border: 1px solid var(--line);
  border-radius: 10px; font-family: var(--grotesk); font-size: var(--t-body);
}
.mlk-grp__search {
  width: 100%; box-sizing: border-box; margin: 0 0 0.35rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--line); border-radius: 10px; font-family: var(--grotesk); font-size: var(--t-small);
  color: var(--ink); background: var(--paper);
}
.mlk-grp__search:focus { outline: none; border-color: var(--accent); }
.mlk-grp__search::placeholder { color: var(--ink-faint); }
.mlk-grp__pick { display: flex; flex-direction: column; gap: 0.15rem; max-height: 14rem; overflow: auto; margin: 0.4rem 0; }
.mlk-grp__pickempty { margin: 0; padding: 0.35rem 0.1rem 0.5rem; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink-faint); text-align: left; }
.mlk-grp__pickempty[hidden] { display: none; }
.mlk-grp__note { text-align: left; }
.mlk-grp__pickrow {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.35rem;
  border-radius: 8px; cursor: pointer; transition: background 0.15s var(--ease);
}
.mlk-grp__pickrow:hover { background: var(--paper-sink); }
.mlk-grp__pickrow span { font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink); }
.mlk-grp__pickrow input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0;
  width: 1.15rem; height: 1.15rem; border: 1px solid var(--line-strong); border-radius: 5px;
  background: var(--paper); cursor: pointer; transition: all 0.15s var(--ease);
}
.mlk-grp__pickrow input[type="checkbox"]:hover { border-color: var(--accent); }
.mlk-grp__pickrow input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.mlk-grp__pickrow input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 0.37rem; top: 0.16rem; width: 0.28rem; height: 0.55rem;
  border: solid var(--paper-raise); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.mlk-grp__av {
  width: var(--mlk-av-sm); height: var(--mlk-av-sm); flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em;
}
.mlk-grp__go {
  width: 100%; margin-top: 0.5rem; padding: 0.55rem; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-family: var(--grotesk); cursor: pointer;
}
.mlk-grp__go:disabled { opacity: 0.5; cursor: default; }
.mlk-grp__foot { display: flex; gap: 0.6rem; margin-top: 0.9rem; }
.mlk-grp__foot .mlk-grp__go { flex: 1; width: auto; margin: 0; border: 1px solid transparent; }
.mlk-grp__cancel {
  flex: 1; padding: 0.55rem; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--paper); color: var(--ink-soft); font-family: var(--grotesk); cursor: pointer;
  transition: all 0.15s var(--ease);
}
.mlk-grp__cancel:hover { border-color: var(--ink); color: var(--ink); }
.mlk-grp__err { margin: 0.3rem 0 0; font-size: var(--t-small); color: #c5352f; min-height: 1.2em; }
.mlk-grp__members { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.8rem 0; max-height: 16rem; overflow: auto; }
.mlk-grp__mem { display: flex; align-items: center; gap: 0.55rem; }
button.mlk-grp__mem { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; font: inherit; color: inherit; padding: 0.35rem 0.45rem; border-radius: 5px; }
button.mlk-grp__mem:hover { background: var(--paper-sink); }
.mlk-grp__memname { font-family: var(--grotesk); font-weight: 600; }
.mlk-grp__memsub { font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); }

.mlk-contact__avwrap { position: relative; flex: none; }
.mlk-contact__live {
  position: absolute; right: -1px; bottom: -1px; width: var(--mlk-av-badge); height: var(--mlk-av-badge); border-radius: 50%;
  background: #2e9e6b; border: 2px solid var(--paper-raise);
}
/* внешние каналы: точка-маркер на аватаре (по образу зелёной точки «в сети»).
   Цвет задаёт модификатор канала — новый мост добавляет две строки, а не
   копирует блок. */
.mlk-contact__chan {
  position: absolute; right: -1px; bottom: -1px; width: var(--mlk-av-badge); height: var(--mlk-av-badge); border-radius: 50%;
  background: var(--mlk-chan, #2f6bd8); border: 2px solid var(--paper-raise);
  box-shadow: 0 0 0 1px oklch(0.52 0.16 258 / 0.35);
}
.mlk-contact__chan.is-mail { --mlk-chan: #2f6bd8; }
.mlk-contact__chan.is-tg   { --mlk-chan: #229ed9; }
.mlk-contact.is-ext .mlk-contact__av { box-shadow: 0 0 0 1.5px oklch(0.52 0.16 258 / 0.4); }
.mlk-b__acts { display: none; }
.mlk-b__gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.25rem; height: 1.25rem; padding: 0; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-faint); cursor: pointer;
  transition: color 0.12s var(--ease), background 0.12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.mlk-b__gear:hover { color: var(--accent-deep); }
.mlk-b.is-me .mlk-b__gear { color: oklch(1 0 0 / 0.72); }
.mlk-b.is-me .mlk-b__gear:hover { color: #fff; background: oklch(1 0 0 / 0.15); }
.mlk-b.is-acts-open .mlk-b__gear { color: var(--accent-deep); }
.mlk-b.is-me.is-acts-open .mlk-b__gear { color: #fff; }
.mlk-b__gear svg { width: 0.68rem; height: 0.68rem; }
.mlk-b__gear-drop {
  display: none; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: flex-end;
  align-self: stretch; gap: 0.22rem; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.mlk-b.is-acts-open .mlk-b__gear-drop { display: flex; }
.mlk-b__replybtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; flex: none; flex-shrink: 0;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink-faint); cursor: pointer;
  transition: color 0.12s var(--ease), background 0.12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.mlk-b__replybtn:hover:not(:disabled) { color: var(--accent-deep); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.mlk-b__replybtn:disabled { opacity: 0.4; cursor: default; }
.mlk-b__replybtn svg { width: 0.9rem; height: 0.9rem; }
.mlk-b__gear-drop .mlk-b__report { flex: none; flex-shrink: 0; }
.mlk-b__report > button, .mlk-b__report > * { min-width: 26px; min-height: 26px; }
@media (hover: none), (max-width: 640px) {
  .mlk-b { padding: 0.55rem 0.8rem; max-width: 92%; }
  .mlk-b.is-voice { min-width: min(92%, 10.5rem); padding-left: 0.55rem; padding-right: 0.7rem; }
  .mlk-b__gear-drop { gap: 0.35rem; }
  .mlk-b__time { gap: 0.35rem; }
  .mlk-b__replybtn { width: 34px; height: 34px; border-radius: 9px; }
  .mlk-b__replybtn svg { width: 1.05rem; height: 1.05rem; }
  .mlk-b__report > button, .mlk-b__report > * { min-width: 34px; min-height: 34px; }
  .mlk-b__report .rep-btn--compact .rep-btn__ic { width: 1.05rem; height: 1.05rem; }
}
.mlk-b__quote {
  display: block; padding: 0.25rem 0.45rem; margin-bottom: 0.25rem; border-left: 2px solid var(--accent);
  background: var(--paper-sink); border-radius: 4px;
}
.mlk-b__quotewho { font-family: var(--mono); font-size: var(--t-micro); color: var(--accent-deep); }
.mlk-b__quotetxt { font-size: var(--t-small); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.mlk-mention { color: var(--accent-deep); font-weight: 600; }
.mlk-mention.is-click { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.mlk-replybar {
  display: none; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.45rem 0.7rem; border-top: 1px solid var(--line); background: var(--paper-sink);
  font-size: var(--t-small);
}
.mlk-replybar.is-on { display: flex; }
.mlk-replybar__x {
  display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem;
  border: 0; background: none; cursor: pointer; color: var(--ink-faint); border-radius: 50%;
  transition: all 0.12s var(--ease);
}
.mlk-replybar__x:hover { color: var(--accent-deep); background: var(--paper-sink); }
.mlk-replybar__x svg { width: 0.95rem; height: 0.95rem; }
.mlk-mention-menu {
  display: none; flex-direction: column; max-height: 9rem; overflow-y: auto;
  border-top: 1px solid var(--line); background: var(--paper-raise);
}
.mlk-mention-menu.is-on { display: flex; }
.mlk-mention-menu__item {
  display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.45rem 0.7rem;
  border: 0; background: none; text-align: left; cursor: pointer; font-family: var(--grotesk); font-size: var(--t-small);
}
.mlk-mention-menu__item:hover { background: var(--accent-wash); }
.mlk-chat__call.is-on { color: var(--accent-deep); border-color: var(--accent); background: var(--accent-wash); }
.mlk-chat__search { display: none; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--line); background: var(--paper-sink); }
.mlk-chat__search.is-on { display: block; }
.mlk-chat__search-in {
  width: 100%; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.45rem 0.8rem;
}
.mlk-b__link { color: var(--accent-deep); text-decoration: underline; word-break: break-all; }
.mlk-b__edited { opacity: 0.75; }
.mlk-b__deleted { font-style: italic; color: var(--ink-faint); }
.mlk-b--deleted { opacity: 0.85; }

/* ---- журнал звонка в переписке (как в Telegram) ---- */
.mlk-b.is-call { padding: 0.5rem 0.6rem 0.45rem; }
.mlk-call-log { display: flex; align-items: center; gap: 0.55rem; }
.mlk-call-log__ic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--accent-wash); color: var(--accent-deep); }
.mlk-call-log__ic.is-missed { background: oklch(0.62 0.18 25 / 0.14); color: #d24a3f; }
.mlk-call-log__ic svg { width: 1.05rem; height: 1.05rem; }
.mlk-call-log__body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mlk-call-log__label { font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink); }
.mlk-call-log__dur { font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); }
.mlk-call-log__cb {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem;
  margin-left: 0.35rem; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper-raise);
  color: var(--ink-soft); cursor: pointer; transition: all 0.15s var(--ease);
}
.mlk-call-log__cb:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-call-log__cb svg { width: 0.95rem; height: 0.95rem; }
.mlk-b.is-flash { animation: mlk-flash 1.2s ease; }
@keyframes mlk-flash { 0%,100% { box-shadow: none; } 30% { box-shadow: 0 0 0 2px var(--accent); } }
.mlk-b__quote.is-click { cursor: pointer; }
.mlk-b__quote.is-click:hover { background: var(--accent-wash); }
.mlk-linkprev {
  display: block; margin-top: 0.35rem; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  text-decoration: none; color: inherit; background: var(--paper-raise);
}
.mlk-linkprev__img { display: block; width: 100%; max-height: 8rem; object-fit: cover; }
.mlk-linkprev__body { display: block; padding: 0.4rem 0.55rem; }
.mlk-linkprev__title { display: block; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink); }
.mlk-linkprev__desc { display: block; font-size: var(--t-micro); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mlk__chat > .mlk-gchat { flex: 1 1 auto; align-self: stretch; width: 100%; min-height: 0; overflow: visible; }
.mlk-gchat {
  --mlk-topics-toggle-w: 0.98rem;
  --mlk-topics-rail: var(--mlk-topics-toggle-w);
  display: grid; grid-template-columns: minmax(9rem, 11rem) 1fr; gap: 0; flex: 1; min-height: 0; min-width: 0;
  position: relative; overflow: visible;
  transition: grid-template-columns 0.22s var(--ease);
}
.mlk-gchat.is-topics-collapsed { grid-template-columns: var(--mlk-topics-rail) 1fr; }
.mlk-gchat > .mlk-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.mlk-gchat .mlk-thread { flex: 1; max-height: none; }
.mlk-topics-wrap {
  position: relative; min-height: 0; min-width: 0; height: 100%; overflow: visible; z-index: 2;
}
.mlk-topics {
  display: flex; flex-direction: column; height: 100%;
  border-right: 1px solid var(--line); background: var(--paper-sink);
  min-height: 0; min-width: 0; overflow: hidden;
  transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}
.mlk-gchat.is-topics-collapsed .mlk-topics__head,
.mlk-gchat.is-topics-collapsed .mlk-topics__list,
.mlk-gchat.is-topics-collapsed .mlk-topics__add {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.mlk-topics__toggle {
  position: absolute; top: 50%; right: 0; z-index: 6;
  width: var(--mlk-topics-toggle-w); height: 2.5rem; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transform: translate(50%, -50%);
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--paper-raise); color: var(--line-strong); cursor: pointer;
  box-shadow: 0 1px 4px oklch(0.2 0.01 60 / 0.08);
  transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.22s var(--ease);
}
.mlk-topics__toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-wash); }
.mlk-topics__toggle .u-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 0.62rem; height: 0.62rem; flex: none;
}
.mlk-topics__toggle .u-ic svg { width: 100%; height: 100%; display: block; }
.mlk-topics__head {
  padding: 0.65rem 0.7rem; font-family: var(--mono); font-size: var(--t-micro);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
}
.mlk-topics__list { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.45rem; overflow-y: auto; flex: 1; min-height: 0; }
.mlk-topics__item, .mlk-topics-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 0.35rem;
  width: 100%; text-align: left; padding: 0.45rem 0.55rem; border: 0; border-radius: 8px;
  background: none; cursor: pointer; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink);
}
.mlk-topics-chip { width: auto; flex: none; white-space: nowrap; border: 1px solid var(--line); background: var(--paper-raise); }
.mlk-topics__item:hover, .mlk-topics-chip:hover { background: var(--paper-raise); }
.mlk-topics__item.is-on, .mlk-topics-chip.is-on { background: var(--accent-wash); color: var(--accent-deep); }
.mlk-topics__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlk-topics__badge {
  flex: none; min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.58rem; background: var(--accent); color: var(--paper-raise);
}
.mlk-topics__add {
  margin: 0.2rem 0.45rem 0.55rem; display: inline-flex; align-items: center; justify-content: center;
  padding: 0.4rem; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: none; cursor: pointer; color: var(--ink-faint);
}
.mlk-topics__add:hover { border-color: var(--accent); color: var(--accent-deep); }
.mlk-topics__add svg { width: 0.9rem; height: 0.9rem; }
.mlk-topics-chips {
  display: none; gap: 0.35rem; padding: 0.45rem 0.7rem; overflow-x: auto; border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.mlk-topics-chip--add, .mlk-topics-chip--more { min-width: 2rem; justify-content: center; font-weight: 600; }
.mlk-topics-chip--add svg, .mlk-topics-chip--more svg { width: 0.95rem; height: 0.95rem; }
.mlk-topics-sheet {
  display: none; position: fixed; inset: 0; z-index: 1280; background: oklch(0.235 0.012 60 / 0.42);
  align-items: flex-end; justify-content: center; padding: 0;
}
.mlk-topics-sheet.is-on { display: flex; }
.mlk-topics-sheet__head {
  display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line); font-family: var(--grotesk); font-weight: 600;
}
.mlk-topics-sheet__x {
  display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.8rem;
  border: 0; background: none; line-height: 1; cursor: pointer; color: var(--ink-faint); border-radius: 50%;
}
.mlk-topics-sheet__x:hover { color: var(--accent-deep); background: var(--paper-sink); }
.mlk-topics-sheet__x svg { width: 1.05rem; height: 1.05rem; }
.mlk-topics-sheet__list {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 0.6rem; max-height: 50vh; overflow-y: auto;
}
.mlk-topics-sheet > .mlk-topics-sheet__list,
.mlk-topics-sheet > .mlk-topics-sheet__head { width: 100%; max-width: 32rem; background: var(--paper-raise); }
.mlk-topics-sheet { flex-direction: column; justify-content: flex-end; }
.mlk-topics-sheet__head, .mlk-topics-sheet__list { margin: 0 auto; width: 100%; max-width: 32rem; background: var(--paper-raise); }
.mlk-topics-sheet__list { border-radius: 0 0 12px 12px; margin-bottom: 0; }
.mlk-topics-sheet__head { border-radius: 12px 12px 0 0; margin-top: auto; }

@media (max-width: 860px) {
  .mlk-gchat { grid-template-columns: 1fr; }
  .mlk-topics-wrap { display: none; }
  .mlk-topics-chips { display: flex; }
}

/* ── удаление диалога/группы, приглашения, блок (добавлено) ───────────── */
.mlk-contact { position: relative; }
.mlk-contact__del {
  position: absolute; top: 0.3rem; right: 0.3rem;
  display: none; align-items: center; justify-content: center;
  width: 1.4rem; height: 1.4rem; padding: 0; border: 0; border-radius: 4px;
  background: transparent; color: var(--ink-faint); cursor: pointer;
}
.mlk-contact__del:hover { background: transparent; color: var(--accent-deep); }
.mlk-contact:hover .mlk-contact__del, .mlk-contact.is-on .mlk-contact__del { display: inline-flex; }
.mlk-contact__del svg { width: 14px; height: 14px; }

.mlk-invite {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.6rem; border: 1px solid var(--line);
  border-radius: 6px; background: var(--paper); margin: 0 0.2rem 0.4rem;
}
.mlk-invite__gav {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--mlk-av-invite); height: var(--mlk-av-invite); border-radius: 50%;
  background: var(--accent-wash); color: var(--accent-deep); flex: 0 0 auto;
}
.mlk-invite__body { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.mlk-invite__name { font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink); font-weight: 600; }
.mlk-invite__by { font-family: var(--grotesk); font-size: var(--t-micro); color: var(--ink-faint); }
.mlk-invite__act { display: flex; gap: 0.3rem; flex: 0 0 auto; }
.mlk-invite__ok, .mlk-invite__no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; padding: 0; border: 1px solid var(--line);
  border-radius: 5px; background: var(--paper-raise); cursor: pointer; color: var(--ink);
}
.mlk-invite__ok:hover { border-color: var(--accent-deep); color: var(--accent-deep); }
.mlk-invite__no:hover { color: var(--accent-deep); }
.mlk-invite__ok[disabled], .mlk-invite__no[disabled] { opacity: 0.5; cursor: default; }
.mlk-invite__ok svg, .mlk-invite__no svg { width: 15px; height: 15px; }

.mlk-grp__pol { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.2rem 0 0.1rem; }
.mlk-grp__polopt { display: flex; align-items: center; gap: 0.4rem; font-family: var(--grotesk); font-size: var(--t-small); color: var(--ink); cursor: pointer; }
.mlk-grp__polopt input { accent-color: var(--accent-deep); }

/* ── мобильная адаптация новых элементов мессенджера ──────────────────── */
/* На сенсорных устройствах hover не срабатывает: крестик удаления должен
   быть виден всегда. Резервируем правый отступ строки, чтобы он не лёг
   поверх времени и счётчика. */
@media (hover: none) {
  .mlk-contact { padding-right: 2.4rem; }
  .mlk-contact__del {
    display: inline-flex;
    top: 50%; right: 0.45rem; transform: translateY(-50%);
    width: 1.85rem; height: 1.85rem; border-radius: 6px;
  }
  .mlk-contact__del svg { width: 16px; height: 16px; }
}

@media (max-width: 720px) {
  .mlk-chat__actions { gap: 0.35rem; }
  .mlk-chat__call:not(.mlk-chat__menu-btn) { width: 2rem; height: 2rem; }
  .mlk .mlk__chat .mlk-chat__head .mlk-chat__call.mlk-chat__menu-btn {
    width: 2.2rem;
    height: 2.2rem;
    min-width: 2.2rem;
    min-height: 2.2rem;
  }
  .mlk .mlk__chat .mlk-chat__head .mlk-chat__open {
    height: 2.2rem;
    min-height: 2.2rem;
  }
  .mlk-chat__call:not(.mlk-chat__menu-btn) svg { width: 1rem; height: 1rem; }
  /* Кнопки нижней панели (скрепка · отправка · голосовой) — того же размера,
     что круглые кнопки в шапке. Ряд выравнивается, а поле ввода получает
     больше места. Работает и для 1:1, и для групп (классы общие). */
  .mlk-attach, .mlk-send, .mlk-mic { width: 2rem; height: 2rem; }
  .mlk-attach svg, .mlk-send svg, .mlk-mic svg { width: 1rem; height: 1rem; }
  /* Поле ввода — той же высоты, что кнопки (2rem), чтобы ряд читался единой
     линией. Шрифт держим 16px (iOS не зумит при фокусе), высоту даём малым
     вертикальным паддингом; при многострочном вводе поле растёт (JS). */
  .mlk-input {
    min-height: 2rem;
    padding: 0.3rem 0.85rem;
    font-size: 0.9rem;
    line-height: 1.3;
    border-radius: 1rem;
  }
  /* Приглашения: тап-цели не меньше ~40px. */
  .mlk-invite { padding: 0.65rem 0.6rem; }
  .mlk-invite__ok, .mlk-invite__no { width: 2.5rem; height: 2.5rem; }
  .mlk-invite__ok svg, .mlk-invite__no svg { width: 17px; height: 17px; }
  .mlk-invite__gav { width: calc(2.2rem * 1.15); height: calc(2.2rem * 1.15); }
}

/* Очень узкие экраны: ряд кнопок шапки не должен ломать вёрстку. */
@media (max-width: 420px) {
  .mlk-chat__actions { gap: 0.25rem; }
  .mlk-chat__call:not(.mlk-chat__menu-btn) { width: 1.85rem; height: 1.85rem; border-width: 1px; }
  .mlk .mlk__chat .mlk-chat__head .mlk-chat__call.mlk-chat__menu-btn,
  .mlk .mlk__chat .mlk-chat__head .mlk-chat__open {
    --mlk-head-btn-h: 2.2rem;
    height: var(--mlk-head-btn-h);
    min-height: var(--mlk-head-btn-h);
  }
  .mlk .mlk__chat .mlk-chat__head .mlk-chat__call.mlk-chat__menu-btn {
    width: var(--mlk-head-btn-h);
    min-width: var(--mlk-head-btn-h);
  }
  .mlk-attach, .mlk-send, .mlk-mic { width: 1.85rem; height: 1.85rem; }
  .mlk-input { min-height: 1.85rem; }
  .mlk-grp__polopt { font-size: var(--t-micro); }
}

/* «Написать на email» — compose-контрол в шапке списка диалогов */
.mlk__lactions { display: inline-flex; align-items: center; gap: 0.4rem; flex: none; }
.mlk__lmenu { position: relative; flex: none; }
.mlk__lmenu-btn svg { width: 0.9rem; height: 0.9rem; }
.mlk__mailcompose { display: none; align-items: center; gap: 0.45rem; padding: 0 0.45rem 0.15rem 1rem; margin-bottom: 0.4rem; --mlk-mail-h: 2.2rem; }
.mlk__mailcompose.is-open { display: flex; }
.mlk__mailin {
  flex: 1; min-width: 0; box-sizing: border-box; height: var(--mlk-mail-h);
  font-family: var(--grotesk); font-size: 1rem; color: var(--ink-faint);
  padding: 0 0.7rem; border: 1px solid var(--line-strong); border-radius: var(--radius-btn-sm, 11px); background: var(--paper);
}
.mlk__mailin:focus { outline: none; border-color: var(--accent); }
.mlk__mailin::placeholder { color: var(--ink-faint); }
.mlk__mailgo {
  flex: none; width: var(--mlk-mail-h); height: var(--mlk-mail-h); min-width: var(--mlk-mail-h); padding: 0; border: 0; border-radius: var(--radius-btn-sm, 11px);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--paper-raise); cursor: pointer;
  transition: background 0.2s var(--ease);
}
.mlk__mailgo:hover { background: var(--accent-deep); }
.mlk__mailgo svg { width: 0.95rem; height: 0.95rem; }
.mlk__mailgo:disabled { opacity: .6; cursor: default; }

/* ---- просмотр изображений (полный цвет, вне offline-filter) ---- */
.mlk-imgview {
  position: fixed; inset: 0; z-index: 12000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.82); padding: 2rem 1rem;
}
.mlk-imgview.is-on { display: flex; }
body.mlk-imgview-open { overflow: hidden; }
.mlk-imgview__img {
  max-width: min(96vw, 56rem); max-height: 88vh; width: auto; height: auto;
  object-fit: contain; border-radius: 8px; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  filter: none;
}
.mlk-imgview__close {
  position: absolute; top: 1rem; right: 1rem; width: 2.4rem; height: 2.4rem;
  border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.12);
  color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.mlk-imgview__close:hover { background: rgba(255, 255, 255, 0.22); }
.mlk-imgview__dl {
  position: absolute; bottom: 1.2rem; right: 1.2rem; width: 2.6rem; height: 2.6rem;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mlk-imgview__dl:hover { background: rgba(0, 0, 0, 0.55); }
.mlk-imgview__dl svg { width: 1.1rem; height: 1.1rem; }

/* ============================================================
   «Тихий ИИ» - приватный side-chat поверх открытого диалога.
   Оверлей перекрывает тред и composer только у автора; в /api/dm
   ничего не уходит, собеседник его не видит.
   ============================================================ */
.mlk-chat { position: relative; }

.mlk-ai-overlay {
  position: absolute; inset: 0; z-index: 40;
  display: none; flex-direction: column; min-height: 0;
  background: var(--paper); animation: mlk-ai-in 0.16s var(--ease);
}
.mlk-ai-overlay.is-on { display: flex; }
@keyframes mlk-ai-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.mlk-ai-head {
  flex: none; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line);
  background: var(--paper-raise);
}
.mlk-ai-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font: 600 var(--t-small)/1 var(--grotesk); color: var(--accent-deep);
  padding: 0.28rem 0.5rem; border-radius: 999px; background: var(--accent-wash);
}
.mlk-ai-badge svg { width: 1rem; height: 1rem; }
.mlk-ai-hint { font: var(--t-micro)/1.2 var(--grotesk); color: var(--ink-faint); flex: 1; min-width: 0; }
.mlk-ai-ctx {
  flex: none; font: var(--t-micro)/1 var(--grotesk); color: var(--ink-soft);
  padding: 0.32rem 0.55rem; border-radius: 999px; cursor: pointer;
  background: none; border: 1px solid var(--line-strong); transition: all 0.15s var(--ease);
}
.mlk-ai-ctx:hover { border-color: var(--accent); color: var(--accent-deep); }
.mlk-ai-ctx.is-on { background: var(--accent); border-color: var(--accent); color: var(--paper-raise); }
.mlk-ai-close {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line-strong); color: var(--ink-soft); transition: all 0.15s var(--ease);
}
.mlk-ai-close:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-ai-close svg { width: 1rem; height: 1rem; }

.mlk-ai-log {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.55rem; padding: 0.9rem 0.75rem;
}
.mlk-ai-row { display: flex; flex-direction: column; max-width: 88%; }
.mlk-ai-row.is-me { align-self: flex-end; align-items: flex-end; }
.mlk-ai-row.is-ai { align-self: flex-start; align-items: flex-start; }
.mlk-ai-bubble {
  font: var(--t-body)/1.45 var(--grotesk); color: var(--ink);
  padding: 0.55rem 0.75rem; border-radius: 0.85rem; white-space: pre-wrap; word-break: break-word;
}
.mlk-ai-row.is-me .mlk-ai-bubble { background: var(--accent); color: var(--paper-raise); border-bottom-right-radius: 0.3rem; }
.mlk-ai-row.is-ai .mlk-ai-bubble { background: var(--paper-sink); border: 1px solid var(--line); border-bottom-left-radius: 0.3rem; }
.mlk-ai-row.is-thinking .mlk-ai-bubble { color: var(--ink-faint); letter-spacing: 0.15em; }
.mlk-ai-acts { display: flex; gap: 0.4rem; margin-top: 0.3rem; }
.mlk-ai-mini {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font: var(--t-micro)/1 var(--grotesk); color: var(--ink-soft); cursor: pointer;
  padding: 0.24rem 0.5rem; border-radius: 999px; background: none;
  border: 1px solid var(--line-strong); transition: all 0.15s var(--ease);
}
.mlk-ai-mini:hover { color: var(--accent-deep); border-color: var(--accent); }
.mlk-ai-mini.is-done { color: var(--accent-deep); border-color: var(--accent); background: var(--accent-wash); }
.mlk-ai-mini svg { width: 0.85rem; height: 0.85rem; }

.mlk-ai-status { flex: none; min-height: 1rem; padding: 0 0.9rem; font: var(--t-micro)/1.3 var(--grotesk); color: var(--accent-deep); }
.mlk-ai-bar { flex: none; display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.7rem; border-top: 1px solid var(--line); }
.mlk-ai-input {
  flex: 1; resize: none; min-height: 2.6rem; max-height: 120px;
  padding: 0.6rem 0.85rem; border-radius: 1.3rem;
  border: 1px solid var(--line-strong); background: var(--paper-raise);
  font: var(--t-body)/1.4 var(--grotesk); color: var(--ink);
}
.mlk-ai-input:focus { outline: none; border-color: var(--accent); }
.mlk-ai-send {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--accent); border: 1px solid var(--accent); color: var(--paper-raise); transition: all 0.15s var(--ease);
}
.mlk-ai-send:hover { background: var(--accent-deep); }
.mlk-ai-send svg { width: 1.1rem; height: 1.1rem; }
@media (max-width: 640px) {
  .mlk-ai-bar { padding-bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px)); }
}

/* ===== Сохранение голосовой ===== */
.mlk-voice__save {
  display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none;
  border: none; background: transparent; color: var(--ink-faint); cursor: pointer; border-radius: 50%;
}
.mlk-voice__save:hover { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.mlk-voice__save svg { width: 15px; height: 15px; }
.mlk-voice__save:disabled { opacity: 0.4; cursor: default; }

/* ===== Панель «Контент чата» (медиа/файлы/аудио/ссылки) ===== */
.mlk-shared {
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column;
  background: var(--paper); animation: mlk-shared-in 0.18s ease;
}
@keyframes mlk-shared-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.mlk-shared__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
  padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); flex: none;
}
.mlk-shared__title { font-family: var(--grotesk); font-size: var(--t-body); color: var(--ink); }
.mlk-shared__x {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border: none;
  background: transparent; color: var(--ink-faint); cursor: pointer; border-radius: 50%;
}
.mlk-shared__x:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); }
.mlk-shared__x svg { width: 16px; height: 16px; }
.mlk-shared__tabs { display: flex; gap: 0.25rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; }
.mlk-shared__tab {
  border: none; background: transparent; color: var(--ink-faint); cursor: pointer;
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.35rem 0.6rem; border-radius: 999px; white-space: nowrap;
}
.mlk-shared__tab:hover { color: var(--ink); }
.mlk-shared__tab.is-on { color: var(--paper); background: var(--ink); }
.mlk-shared__body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.75rem; }
.mlk-shared__empty { color: var(--ink-faint); font-family: var(--mono); font-size: var(--t-micro); text-align: center; padding: 2rem 0; }
.mlk-shared__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 4px; }
.mlk-shared__tile {
  position: relative; aspect-ratio: 1; border: none; padding: 0; cursor: pointer;
  background: var(--paper-sink, #eee); border-radius: 3px; overflow: hidden;
}
.mlk-shared__thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.mlk-shared__tile.is-video { display: grid; place-items: center; color: var(--ink-faint); }
.mlk-shared__vic svg { width: 22px; height: 22px; }
.mlk-shared__rows { display: flex; flex-direction: column; }
.mlk-shared__row, .mlk-shared__link {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.mlk-shared__rowic { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; color: var(--ink-faint); border-radius: 50%; }
.mlk-shared__rowic.is-click { cursor: pointer; }
.mlk-shared__rowic.is-click:hover { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.mlk-shared__rowic svg { width: 16px; height: 16px; }
.mlk-shared__rowtx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mlk-shared__rowt { font-size: var(--t-body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlk-shared__rowsub { font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlk-shared__link:hover .mlk-shared__rowt { color: var(--accent); }
.mlk-shared__save {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border: none; background: transparent; color: var(--ink-faint); cursor: pointer; border-radius: 50%;
}
.mlk-shared__save:hover { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.mlk-shared__save svg { width: 15px; height: 15px; }
.mlk-shared__save:disabled { opacity: 0.4; cursor: default; }

/* ===== Shared-панель: видеоплеер, битые файлы ===== */
.mlk-shared__tile.is-broken { opacity: 0.5; }
.mlk-shared__row.is-broken { opacity: 0.55; }
.mlk-shared__row.is-broken .mlk-shared__rowsub { color: var(--danger, #c0392b); }
.mlk-shared__vov {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  background: color-mix(in oklab, #000 78%, transparent); padding: 1rem;
}
.mlk-shared__vov-el { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000; }
.mlk-shared__vov-x {
  position: absolute; top: 0.6rem; right: 0.6rem; width: 36px; height: 36px; display: grid; place-items: center;
  border: none; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; cursor: pointer;
}
.mlk-shared__vov-x svg { width: 16px; height: 16px; }
.mlk-shared__more {
  display: block; margin: 0.8rem auto; padding: 0.45rem 1.1rem; border: 1px solid var(--line);
  background: transparent; color: var(--ink); border-radius: 999px; cursor: pointer;
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.04em;
}
.mlk-shared__more:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); border-color: var(--accent); color: var(--accent); }
.mlk-shared__more:disabled { opacity: 0.5; cursor: default; }

/* ===== Аудиофайл в ленте: inline-плеер ===== */
.mlk-file.is-audiofile { align-items: center; }
.mlk-file__play {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: none; border-radius: 50%; background: var(--accent); color: var(--paper); cursor: pointer;
}
.mlk-file__play svg { width: 15px; height: 15px; }
.mlk-file__play:hover { filter: brightness(1.05); }

/* ===== Закрепление ===== */
.mlk-b__pin.is-on { color: var(--accent); }
.mlk-pins { display: none; }
.mlk-pins.is-on {
  display: flex; align-items: center; gap: 0.55rem; flex: none;
  padding: 0.5rem 0.85rem; border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--accent) 6%, var(--paper));
}
.mlk-pins__ic { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; color: var(--accent); }
.mlk-pins__ic svg { width: 15px; height: 15px; }
.mlk-pins__body { display: flex; flex-direction: column; min-width: 0; flex: 1; cursor: pointer; border-left: 2px solid var(--accent); padding-left: 0.55rem; }
.mlk-pins__title { font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.05em; color: var(--accent); }
.mlk-pins__text { font-size: var(--t-body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlk-pins__x { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; border-radius: 50%; }
.mlk-pins__x:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); }
.mlk-pins__x svg { width: 14px; height: 14px; }

/* ===== Пересылка ===== */
.mlk-b__fwd {
  font-family: var(--mono); font-size: var(--t-micro); letter-spacing: 0.04em;
  color: var(--accent); margin-bottom: 0.15rem;
}
.mlk-thread.is-select .mlk-b { cursor: pointer; }
.mlk-thread.is-select .mlk-b__gear,
.mlk-thread.is-select .mlk-b__gear-drop { display: none; }
.mlk-b.is-picked { background: color-mix(in oklab, var(--accent) 14%, transparent); border-radius: 8px; }
.mlk-select { display: none; }
.mlk-select.is-on {
  display: flex; align-items: center; gap: 0.55rem; flex: none;
  padding: 0.55rem 0.85rem; border-top: 1px solid var(--line);
  background: color-mix(in oklab, var(--accent) 6%, var(--paper));
}
.mlk-select__x { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; border-radius: 50%; }
.mlk-select__x:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); }
.mlk-select__x svg { width: 15px; height: 15px; }
.mlk-select__n { flex: 1; font-family: var(--mono); font-size: var(--t-micro); color: var(--ink-faint); }
.mlk-select__go {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.85rem;
  border: none; border-radius: 999px; background: var(--accent); color: #fff;
  font: inherit; font-size: var(--t-body); cursor: pointer;
}
.mlk-select__go svg { width: 15px; height: 15px; }
.mlk-select__go:disabled { opacity: 0.45; cursor: default; }

.mlk-fwd { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in oklab, #000 45%, transparent); }
.mlk-fwd__panel { width: min(420px, 92vw); max-height: 78vh; display: flex; flex-direction: column; background: var(--paper); border-radius: 12px; overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,0.28); }
.mlk-fwd__head { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.mlk-fwd__title { font-family: var(--grotesk); font-size: var(--t-body); color: var(--ink); }
.mlk-fwd__x { display: inline-grid; place-items: center; width: 30px; height: 30px; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; border-radius: 50%; }
.mlk-fwd__x:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); }
.mlk-fwd__x svg { width: 15px; height: 15px; }
.mlk-fwd__search { margin: 0.7rem 1rem; padding: 0.5rem 0.75rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--paper-sink, #f5f5f5); color: var(--ink); }
.mlk-fwd__list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0.5rem 0.6rem; }
.mlk-fwd__empty { color: var(--ink-faint); font-family: var(--mono); font-size: var(--t-micro); text-align: center; padding: 1.5rem 0; }
.mlk-fwd__row { display: flex; align-items: center; gap: 0.65rem; width: 100%; border: none; background: transparent; cursor: pointer; padding: 0.55rem 0.6rem; border-radius: 8px; text-align: left; }
.mlk-fwd__row:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.mlk-fwd__gav { display: inline-grid; place-items: center; width: var(--mlk-av-fwd); height: var(--mlk-av-fwd); flex: none; border-radius: 50%; background: color-mix(in oklab, var(--ink) 8%, transparent); color: var(--ink-faint); line-height: 0; }
.mlk-fwd__av { width: var(--mlk-av-fwd); height: var(--mlk-av-fwd); flex: none; }
.mlk-fwd__name { font-size: var(--t-body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Избранное (self-DM) ===== */
.mlk-contact__gav.is-saved, .mlk-chat__gav.is-saved {
  background: color-mix(in oklab, var(--accent) 16%, transparent); color: var(--accent);
}
.mlk-contact__gav.is-saved .u-ic svg,
.mlk-chat__gav.is-saved .u-ic svg { width: 100%; height: 100%; }

/* Rupor mobile: шапка не переносится криво */
@media (max-width: 640px) {
  .mlk-chat.is-rupor .mlk-chat__actions,
  .mlk-chat__actions {
    flex-wrap: nowrap;
    overflow: visible;
    max-width: 100%;
  }
  .mlk-chat.is-rupor .mlk-chat__meta { max-width: 62%; }
  .mlk-chat__call { flex: none; }
}

/* Исходящие — сплошная терракота, белый текст (контраст иконок действий) */
.mlk-b.is-me {
  background: var(--accent);
  border-color: transparent;
  color: var(--paper-raise);
  border-radius: var(--radius-md, 16px) var(--radius-md, 16px) calc(var(--radius-btn-sm, 11px) / 2) var(--radius-md, 16px);
  box-shadow: 0 2px 6px oklch(0.45 0.09 42 / 0.22);
}
.mlk-b.is-me .mlk-b__time { color: oklch(1 0 0 / 0.72); }
.mlk-b.is-me .mlk-rc { color: oklch(1 0 0 / 0.75); opacity: 1; }
.mlk-b.is-me .mlk-rc--read { color: #fff; }
.mlk-b.is-me .mlk-b__edited { color: oklch(1 0 0 / 0.6); }
.mlk-b.is-me .mlk-b__replybtn { color: oklch(1 0 0 / 0.7); }
.mlk-b.is-me .mlk-b__replybtn:hover:not(:disabled) { color: #fff; background: oklch(1 0 0 / 0.18); }
.mlk-b.is-me .mlk-b__pin.is-on { color: #fff; }
.mlk-b.is-me .mlk-b__report > button, .mlk-b.is-me .mlk-b__report svg { color: oklch(1 0 0 / 0.7); }
.mlk-b.is-me a, .mlk-b.is-me .mlk-b__link { color: #fff; }
.mlk-b.is-me .mlk-mention { color: #fff; }
.mlk-b.is-me .mlk-b__fwd { color: oklch(1 0 0 / 0.85); border-left-color: oklch(1 0 0 / 0.55); }
.mlk-b.is-me .mlk-b__quote { background: oklch(1 0 0 / 0.15); border-left-color: oklch(1 0 0 / 0.65); }
.mlk-b.is-me .mlk-b__quotewho { color: oklch(1 0 0 / 0.9); }
.mlk-b.is-me .mlk-b__quotetxt { color: oklch(1 0 0 / 0.78); }
.mlk-b.is-me .mlk-voice__play { color: oklch(1 0 0); }
.mlk-b.is-me .mlk-voice__bar { color: oklch(1 0 0 / 0.7); }
.mlk-b.is-me .mlk-voice__time { color: oklch(1 0 0 / 0.82); }
.mlk-b.is-me .mlk-voice__save, .mlk-b.is-me .mlk-file__dl, .mlk-b.is-me .mlk-file__play { color: oklch(1 0 0 / 0.8); }
.mlk-b.is-me .mlk-file__meta { color: oklch(1 0 0 / 0.7); }
.mlk-b.is-me .mlk-linkprev { border-color: oklch(1 0 0 / 0.3); background: oklch(1 0 0 / 0.1); }
.mlk-b.is-me .mlk-linkprev__title { color: #fff; }
.mlk-b.is-me .mlk-linkprev__desc { color: oklch(1 0 0 / 0.75); }
.mlk-b.is-me .mlk-b__t { color: var(--paper-raise); }

/* Шапка чата: белая подложка под кнопками (мобила и десктоп) */
.mlk .mlk-chat__head,
.mlk .mlk-chat__head .mlk-chat__meta,
.mlk .mlk-chat__head .mlk-chat__actions {
  background: var(--paper-raise);
}
.mlk .mlk-chat__head .mlk-chat__actions {
  overflow: visible;
}
