/* wbchat — интерфейс в стиле Rocket.Chat (Fuselage light) */
:root {
  --primary: #156ff5;
  --primary-hover: #095ad2;
  --primary-soft: #e8f2ff;
  --danger: #ec0d2a;
  --danger-hover: #bb0b21;
  --font-default: #2f343d;
  --font-title: #1f2329;
  --font-secondary: #6c737a;
  --font-hint: #9ea2a8;
  --surface: #ffffff;
  --surface-tint: #f7f8fa;
  --surface-hover: #f2f3f5;
  --surface-neutral: #e4e7ea;
  --surface-selected: #d7dbe0;
  --stroke-light: #ebecef;
  --stroke-medium: #cbced1;
  --status-online: #158d65;
  --status-offline: #9ea2a8;
  --badge: #156ff5;
  --shadow-1: 0 0 2px rgba(47,52,61,.08), 0 0 12px rgba(47,52,61,.12);
  --shadow-2: 0 0 2px rgba(47,52,61,.08), 0 0 24px rgba(47,52,61,.2);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px; color: var(--font-default); background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(47,52,61,.18); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 16px; border-radius: 4px;
  font-weight: 500; font-size: 14px; border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--surface-neutral); color: var(--font-hint); cursor: default; }
.btn-ghost { border-color: var(--stroke-medium); color: var(--font-default); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 4px; color: var(--font-secondary); flex: none;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--font-default); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- аватары ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; color: #fff; font-weight: 600; flex: none;
  background: var(--primary); user-select: none; overflow: hidden;
}
.avatar-20 { width: 20px; height: 20px; font-size: 10px; border-radius: 3px; }
.avatar-24 { width: 24px; height: 24px; font-size: 12px; }
.avatar-36 { width: 36px; height: 36px; font-size: 16px; }
.status-dot {
  position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px;
  border-radius: 50%; border: 2px solid var(--surface-tint); background: var(--status-offline);
}
.status-dot.online { background: var(--status-online); }
.presence { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--status-offline); }
.presence.online { background: var(--status-online); box-shadow: none; }

/* ---------- вход ---------- */
.auth {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 20% 0%, #0d3a68 0%, #041c38 55%, #010e1e 100%);
  overflow: auto; padding: 24px;
}
.auth-inner { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; color: #fff; font-size: 24px; margin-bottom: 20px; letter-spacing: .2px; }
.auth-logo b { font-weight: 700; }
.auth-card {
  background: var(--surface); border-radius: 8px; padding: 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 14px;
}
.auth-card h1 { font-size: 18px; font-weight: 700; color: var(--font-title); }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--font-default); }
.fld input {
  height: 40px; padding: 0 12px; border: 1px solid var(--stroke-medium); border-radius: 4px;
  font: inherit; color: var(--font-default); outline: none; background: var(--surface);
}
.fld input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21,111,245,.25); }
.auth-error { background: #ffe9ec; color: var(--danger); border-radius: 4px; padding: 10px 12px; font-size: 13px; }
.auth-alt { font-size: 13px; color: var(--font-secondary); text-align: center; }
.auth-foot { text-align: center; color: rgba(255,255,255,.45); font-size: 12px; margin-top: 18px; }

/* ---------- каркас ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- сайдбар ---------- */
.sidebar {
  width: 280px; flex: none; background: var(--surface-tint);
  display: flex; flex-direction: column; border-right: 1px solid var(--stroke-light);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.avatar-btn { position: relative; display: inline-flex; border-radius: 4px; }
.avatar-btn:hover { box-shadow: 0 0 0 3px var(--surface-hover); }
.sidebar-top-actions { display: flex; gap: 2px; }
.sidebar-search { padding: 0 12px 8px; }
.search-input-row { display: flex; align-items: center; gap: 4px; }
.search-input-row input {
  flex: 1; height: 32px; padding: 0 10px; border: 1px solid var(--stroke-medium); border-radius: 4px;
  font: inherit; font-size: 13px; outline: none; background: var(--surface); min-width: 0;
}
.search-input-row input:focus { border-color: var(--primary); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 0 12px; }

.side-section {
  display: flex; align-items: center; gap: 4px; padding: 12px 16px 4px;
  font-size: 12px; font-weight: 600; color: var(--font-secondary); cursor: pointer; user-select: none;
}
.side-section svg { width: 16px; height: 16px; transition: transform .12s; }
.side-section.collapsed svg { transform: rotate(-90deg); }
.side-section .sec-plus { margin-left: auto; opacity: 0; width: 24px; height: 24px; }
.side-section:hover .sec-plus { opacity: 1; }

.room-item {
  display: flex; align-items: center; gap: 8px; margin: 1px 8px; padding: 6px 8px;
  border-radius: 4px; cursor: pointer; color: var(--font-default); min-height: 32px;
}
.room-item:hover { background: var(--surface-hover); }
.room-item.active { background: var(--surface-selected); }
.room-item .ri-ico { width: 20px; display: inline-flex; justify-content: center; color: var(--font-secondary); flex: none; position: relative; }
.room-item .ri-ico svg { width: 18px; height: 18px; }
.room-item .ri-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.room-item.unread .ri-name { font-weight: 700; color: var(--font-title); }
.badge {
  background: var(--badge); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ri-dot { position: absolute; right: -3px; bottom: -3px; width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid var(--surface-tint); background: var(--status-offline); }
.ri-dot.online { background: var(--status-online); }

.search-item { display: flex; align-items: center; gap: 8px; padding: 8px 16px; cursor: pointer; }
.search-item:hover { background: var(--surface-hover); }
.search-item .si-sub { margin-left: auto; color: var(--font-hint); font-size: 12px; }
.search-empty { padding: 16px; color: var(--font-hint); font-size: 13px; text-align: center; }

/* ---------- шапка комнаты ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.room-header {
  display: flex; align-items: center; gap: 8px; height: 56px; flex: none;
  padding: 0 16px; border-bottom: 1px solid var(--stroke-light);
}
.room-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.room-ico { display: inline-flex; color: var(--font-secondary); }
.room-ico svg { width: 20px; height: 20px; }
.room-name-col { min-width: 0; }
.room-name-col h1 { font-size: 16px; font-weight: 700; color: var(--font-title);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.room-sub { font-size: 12px; color: var(--font-secondary); white-space: nowrap; overflow: hidden; display: block; }
.room-actions { display: flex; gap: 2px; }

/* ---------- сообщения ---------- */
.room-body { flex: 1; display: flex; min-height: 0; }
.messages-col { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.messages-col.dragover::after {
  content: 'Отпустите, чтобы загрузить файл'; position: absolute; inset: 8px; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--primary); border-radius: 8px; background: rgba(232,242,255,.92);
  color: var(--primary); font-size: 16px; font-weight: 600; pointer-events: none;
}
.messages { flex: 1; overflow-y: auto; padding: 12px 0 8px; }

.day-sep { display: flex; align-items: center; margin: 12px 0 4px; padding: 0 20px; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--stroke-light); }
.day-sep span {
  padding: 2px 12px; margin: 0 8px; font-size: 12px; font-weight: 600; color: var(--font-secondary);
  border: 1px solid var(--stroke-light); border-radius: 12px; background: var(--surface);
}

.msg { position: relative; display: flex; gap: 12px; padding: 4px 20px; }
.msg:hover { background: var(--surface-hover); }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg .msg-gutter { width: 36px; flex: none; display: flex; justify-content: center; }
.msg .msg-time-hover { display: none; font-size: 11px; color: var(--font-hint); align-self: flex-start; margin-top: 4px; }
.msg.compact:hover .msg-time-hover { display: block; }
.msg .msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 6px; }
.msg-head .who { font-weight: 700; font-size: 14px; color: var(--font-title); cursor: pointer; }
.msg-head .who:hover { text-decoration: underline; }
.msg-head .uname { color: var(--font-hint); font-size: 12px; }
.msg-head .when { color: var(--font-hint); font-size: 12px; }
.msg-text { font-size: 14.5px; line-height: 20px; word-wrap: break-word; white-space: pre-wrap; }
.msg-text .edited-flag { color: var(--font-hint); font-size: 11px; margin-left: 4px; }
.msg-text code { background: var(--surface-tint); border: 1px solid var(--stroke-light); border-radius: 3px;
  padding: 0 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #b93d3d; }
.msg-text pre { background: var(--surface-tint); border: 1px solid var(--stroke-light); border-radius: 4px;
  padding: 8px 10px; margin: 4px 0; overflow-x: auto; }
.msg-text pre code { background: none; border: 0; padding: 0; color: var(--font-default); }
.deleted { color: var(--font-hint); font-style: italic; font-size: 13.5px; }

.quote-ref {
  display: block; border-left: 3px solid var(--stroke-medium); background: var(--surface-tint);
  border-radius: 0 4px 4px 0; padding: 4px 10px; margin: 2px 0 4px; font-size: 13px; cursor: pointer;
}
.quote-ref b { color: var(--font-secondary); font-size: 12px; display: block; }
.quote-ref span { color: var(--font-secondary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msg .thumb { max-width: 360px; max-height: 260px; border-radius: 4px; margin-top: 4px; display: block; cursor: zoom-in; }
.file-card {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 4px; padding: 10px 14px;
  border: 1px solid var(--stroke-light); border-radius: 4px; background: var(--surface-tint); color: var(--font-default);
}
.file-card:hover { text-decoration: none; border-color: var(--stroke-medium); }
.file-card svg { width: 22px; height: 22px; color: var(--font-secondary); flex: none; }
.file-card .fc-name { font-weight: 600; font-size: 13.5px; word-break: break-all; }
.file-card .fc-sub { font-size: 12px; color: var(--font-hint); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; cursor: pointer;
  border: 1px solid var(--stroke-light); background: var(--surface-tint); border-radius: 4px; font-size: 13px;
}
.reaction:hover { border-color: var(--stroke-medium); }
.reaction.mine { background: var(--primary-soft); border-color: var(--primary); }
.reaction .rn { font-size: 12px; font-weight: 600; color: var(--font-secondary); }
.reaction-add { opacity: 0; }
.msg:hover .reaction-add { opacity: 1; }

.msg-toolbar {
  position: absolute; top: -14px; right: 20px; display: none; align-items: center;
  background: var(--surface); border: 1px solid var(--stroke-light); border-radius: 4px;
  box-shadow: var(--shadow-1); padding: 2px; z-index: 3;
}
.msg:hover .msg-toolbar { display: inline-flex; }
.msg-toolbar .icon-btn { width: 28px; height: 28px; }
.msg-toolbar .icon-btn svg { width: 18px; height: 18px; }

/* ---------- композер ---------- */
.composer-area { flex: none; padding: 0 20px 8px; }
.reply-bar, .edit-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 4px;
  background: var(--surface-tint); border: 1px solid var(--stroke-light); border-radius: 4px; font-size: 13px;
}
.reply-strip { width: 3px; align-self: stretch; background: var(--primary); border-radius: 2px; }
.reply-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reply-info span { color: var(--font-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-bar { border-color: #f3be08; background: #fff8e0; color: #8a6d00; }
.edit-bar span { flex: 1; font-weight: 600; }

.composer { border: 1px solid var(--stroke-medium); border-radius: 4px; background: var(--surface); }
.composer.focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21,111,245,.18); }
.composer.editing { border-color: #f3be08; box-shadow: 0 0 0 2px rgba(243,190,8,.2); }
.composer textarea {
  width: 100%; border: 0; outline: none; resize: none; font: inherit; font-size: 14.5px;
  padding: 10px 12px 4px; max-height: 160px; background: transparent; color: var(--font-default);
}
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 4px; }
.ct-left { display: flex; align-items: center; gap: 1px; }
.icon-btn.ct { width: 28px; height: 28px; }
.icon-btn.ct svg { width: 18px; height: 18px; }
.ct-sep { width: 1px; height: 16px; background: var(--stroke-light); margin: 0 5px; }
.send-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 28px; border-radius: 4px; color: var(--primary);
}
.send-btn svg { width: 20px; height: 20px; }
.send-btn:disabled { color: var(--stroke-medium); cursor: default; }
.send-btn:not(:disabled):hover { background: var(--primary-soft); }
.composer-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 3px 2px 0; min-height: 20px; font-size: 12px; color: var(--font-hint);
}
.typing { font-style: italic; }
.hint-md { white-space: nowrap; overflow: hidden; }
.hint-md code { font-family: ui-monospace, Menlo, monospace; }

/* ---------- контекстная панель ---------- */
.context-bar {
  width: 320px; flex: none; border-left: 1px solid var(--stroke-light);
  display: flex; flex-direction: column; background: var(--surface);
}
.ctx-head { display: flex; align-items: center; gap: 8px; height: 56px; flex: none;
  padding: 0 12px 0 16px; border-bottom: 1px solid var(--stroke-light); }
.ctx-ico { display: inline-flex; color: var(--font-secondary); }
.ctx-ico svg { width: 20px; height: 20px; }
.ctx-title { flex: 1; font-weight: 700; font-size: 15px; color: var(--font-title); }
.ctx-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.ctx-search { padding: 4px 16px 8px; }
.ctx-search input { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--stroke-medium);
  border-radius: 4px; font: inherit; font-size: 13px; outline: none; }
.ctx-search input:focus { border-color: var(--primary); }

.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer; }
.member-row:hover { background: var(--surface-hover); }
.member-row .mr-col { min-width: 0; }
.member-row .mr-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.member-row .mr-sub { font-size: 12px; color: var(--font-hint); }
.admin-chip { font-size: 10px; font-weight: 700; background: var(--surface-neutral); color: var(--font-secondary);
  border-radius: 3px; padding: 1px 5px; text-transform: uppercase; }

.sr-row { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--stroke-light); }
.sr-row:hover { background: var(--surface-hover); }
.sr-meta { font-size: 12px; color: var(--font-secondary); margin-bottom: 2px; display: flex; gap: 6px; }
.sr-meta b { color: var(--font-title); }
.sr-text { font-size: 13.5px; color: var(--font-default); word-break: break-word; }
.sr-text mark { background: #fff3c2; border-radius: 2px; }

/* ---------- меню / попапы / модалки ---------- */
#popLayer { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.pop-backdrop { position: fixed; inset: 0; pointer-events: auto; }
.menu {
  position: fixed; min-width: 200px; background: var(--surface); border-radius: 4px;
  box-shadow: var(--shadow-2); border: 1px solid var(--stroke-light); padding: 4px; pointer-events: auto; z-index: 101;
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border-radius: 4px; font-size: 14px; color: var(--font-default); text-align: left; }
.menu-item:hover { background: var(--surface-hover); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 18px; height: 18px; color: var(--font-secondary); flex: none; }
.menu-item.danger svg { color: var(--danger); }
.menu-sep { height: 1px; background: var(--stroke-light); margin: 4px 6px; }
.menu-user { padding: 10px 12px 8px; }
.menu-user .mu-name { font-weight: 700; color: var(--font-title); }
.menu-user .mu-uname { font-size: 12px; color: var(--font-hint); }

.emoji-pop {
  position: fixed; width: 288px; max-height: 320px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--stroke-light); border-radius: 6px; box-shadow: var(--shadow-2);
  padding: 8px; pointer-events: auto; z-index: 102;
}
.emoji-cat { font-size: 11px; font-weight: 700; color: var(--font-hint); text-transform: uppercase;
  padding: 6px 4px 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-grid button { font-size: 19px; padding: 4px 0; border-radius: 4px; line-height: 1.25; }
.emoji-grid button:hover { background: var(--surface-hover); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(31,35,41,.5); display: flex;
  align-items: center; justify-content: center; pointer-events: auto; z-index: 110; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-2);
  width: 100%; max-width: 440px; padding: 24px; display: flex; flex-direction: column; gap: 16px;
}
.modal h2 { font-size: 18px; font-weight: 700; color: var(--font-title); display: flex; align-items: center; gap: 10px; }
.modal h2 svg { width: 22px; height: 22px; color: var(--font-secondary); }
.modal p { color: var(--font-secondary); font-size: 14px; line-height: 1.45; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal input.modal-input { height: 40px; padding: 0 12px; border: 1px solid var(--stroke-medium);
  border-radius: 4px; font: inherit; outline: none; width: 100%; }
.modal input.modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21,111,245,.2); }
.modal .user-pick { max-height: 260px; overflow-y: auto; border: 1px solid var(--stroke-light); border-radius: 4px; }

.img-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: flex;
  align-items: center; justify-content: center; pointer-events: auto; z-index: 120; cursor: zoom-out; }
.img-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 4px; }

/* ---------- звонок ---------- */
.call-overlay { position: fixed; inset: 0; background: rgba(31,35,41,.72); z-index: 130;
  display: flex; align-items: center; justify-content: center; padding: 3vh 3vw; }
.call-box { width: 100%; height: 100%; background: #1f2329; border-radius: 8px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-2); }
.call-topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; color: #fff; }
.call-status { font-weight: 600; }
.call-frame-holder { flex: 1; }
.call-frame-holder iframe { width: 100%; height: 100%; border: 0; }

/* ---------- статусы (RC): online/away/busy ---------- */
:root { --status-away: #f3be08; --status-busy: #ec0d2a; }
.presence.away { background: var(--status-away); box-shadow: none; }
.presence.busy { background: var(--status-busy); box-shadow: none; }
.status-dot.away { background: var(--status-away); }
.status-dot.busy { background: var(--status-busy); }
.ri-dot.away { background: var(--status-away); }
.ri-dot.busy { background: var(--status-busy); }
.menu-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ---------- упоминания ---------- */
.mention { background: rgba(21,111,245,.12); color: var(--primary); border-radius: 3px; padding: 0 3px; font-weight: 600; }
.mention.me { background: var(--danger); color: #fff; }
.badge.mention-badge { background: var(--danger); }
.mention-pop {
  position: absolute; left: 20px; right: 20px; bottom: 100%; margin-bottom: 4px;
  background: var(--surface); border: 1px solid var(--stroke-light); border-radius: 6px;
  box-shadow: var(--shadow-2); max-height: 240px; overflow-y: auto; z-index: 20;
}
.composer-area { position: relative; }
.mention-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; font-size: 14px; }
.mention-item .mi-uname { color: var(--font-hint); font-size: 12px; }
.mention-item.sel, .mention-item:hover { background: var(--surface-hover); }

/* ---------- треды ---------- */
.thread-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 3px 8px;
  border: 1px solid var(--stroke-light); border-radius: 4px; cursor: pointer;
  color: var(--primary); font-size: 12.5px; font-weight: 600; background: var(--surface);
}
.thread-link:hover { border-color: var(--primary); }
.thread-link svg { width: 15px; height: 15px; }
.thread-link .tl-time { color: var(--font-hint); font-weight: 400; }
.thread-root-wrap { border-bottom: 1px solid var(--stroke-light); padding-bottom: 8px; margin-bottom: 4px; }
.thread-count-sep { display: flex; align-items: center; gap: 8px; padding: 6px 16px; color: var(--font-hint); font-size: 12px; }
.thread-composer { padding: 8px 12px 10px; border-top: 1px solid var(--stroke-light); flex: none; }
.thread-composer .composer textarea { padding: 8px 10px 4px; font-size: 14px; }
.ctx-messages { flex: 1; overflow-y: auto; padding: 8px 0; }
.context-bar .msg { padding-left: 12px; padding-right: 12px; }
.context-bar .msg-toolbar { right: 12px; }

/* ---------- закреплённые ---------- */
.pin-flag { display: inline-flex; color: var(--font-hint); margin-left: 2px; }
.pin-flag svg { width: 13px; height: 13px; }
.pin-row { padding: 10px 16px; border-bottom: 1px solid var(--stroke-light); cursor: pointer; }
.pin-row:hover { background: var(--surface-hover); }
.pin-row .sr-meta { display: flex; gap: 6px; align-items: center; }
.pin-row .pin-unpin { margin-left: auto; }

/* ---------- OG-превью ссылок ---------- */
.og-card {
  display: flex; gap: 12px; margin-top: 6px; padding: 10px 12px; max-width: 480px;
  border: 1px solid var(--stroke-light); border-left: 3px solid var(--stroke-medium);
  border-radius: 4px; background: var(--surface-tint);
}
.og-card .og-col { min-width: 0; flex: 1; }
.og-card .og-host { font-size: 12px; color: var(--font-hint); }
.og-card .og-title { font-weight: 600; font-size: 13.5px; display: block; margin: 1px 0; }
.og-card .og-desc { font-size: 12.5px; color: var(--font-secondary); line-height: 1.35; max-height: 50px; overflow: hidden; }
.og-card img { max-width: 110px; max-height: 80px; border-radius: 4px; object-fit: cover; flex: none; }

/* ---------- заметка композера (мут/архив) ---------- */
.composer-note {
  padding: 10px 12px; border: 1px dashed var(--stroke-medium); border-radius: 4px;
  color: var(--font-secondary); font-size: 13.5px; background: var(--surface-tint); text-align: center;
}

/* ---------- участники: роли ---------- */
.member-row .mr-kebab { margin-left: auto; opacity: 0; }
.member-row:hover .mr-kebab { opacity: 1; }
.member-row .presence { margin-left: auto; }
.member-row:hover .presence { display: none; }
.ctx-topbtn { margin: 4px 16px 8px; }
.chip-muted { font-size: 10px; font-weight: 700; background: #ffe9ec; color: var(--danger); border-radius: 3px; padding: 1px 5px; }

/* ---------- каталог каналов в поиске ---------- */
.si-join { margin-left: auto; color: var(--primary); font-size: 12px; font-weight: 600; }

/* ---------- мобильный ---------- */
.only-mobile { display: none !important; }
@media (max-width: 768px) {
  .only-mobile { display: inline-flex !important; }
  .sidebar { position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; width: 82vw; max-width: 320px;
    transform: translateX(-105%); transition: transform .18s ease; box-shadow: var(--shadow-2); }
  .sidebar.open { transform: none; }
  .context-bar { position: fixed; z-index: 89; top: 0; bottom: 0; right: 0; width: 90vw; max-width: 340px;
    box-shadow: var(--shadow-2); }
  .hint-md { display: none; }
  .msg .thumb { max-width: 78vw; }
  .room-actions .icon-btn { width: 30px; }
}
