:root {
    --orange: #FF6900; --orange-d: #D95708; --bg: #EEF0F3; --card: #fff; --text: #1f2328;
    --muted: #7a828c; --line: #e3e6ea; --own: #FFF1E6; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; display: flex; flex-direction: column; }
a { color: var(--orange-d); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* Шапка и логотип */
.top { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: linear-gradient(180deg, #FF7A1A, var(--orange-d)); color: #fff; flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 6px; color: #fff; font-weight: 700; font-size: 18px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-box { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: #fff; color: var(--orange-d); border-radius: 7px; font-size: 18px; }
.logo-forum { margin-left: 4px; font-family: "Segoe Script", "Brush Script MT", "Comic Sans MS", cursive; font-style: italic; font-size: 24px; letter-spacing: .5px; background: linear-gradient(90deg, #fff, #FFE2B8 60%, #FFD1E8); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 0 18px rgba(255,255,255,.35); filter: drop-shadow(0 1px 1px rgba(120,40,0,.45)); }
.logo-big { font-size: 34px; color: var(--orange-d); justify-content: center; }
.logo-big .logo-box { width: 52px; height: 52px; font-size: 32px; background: var(--orange-d); color: #fff; border-radius: 12px; }
.logo-big .logo-forum { font-size: 44px; background: linear-gradient(90deg, #FF6900, #E5287A); -webkit-background-clip: text; background-clip: text; filter: none; text-shadow: none; }
.search { flex: 1; max-width: 360px; }
.search input { width: 100%; border: 0; border-radius: 18px; padding: 7px 14px; background: rgba(255,255,255,.22); color: #fff; outline: none; font-size: 14px; }
.search input::placeholder { color: rgba(255,255,255,.8); }
.search input:focus { background: #fff; color: var(--text); }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.muted-link { color: rgba(255,255,255,.9); font-size: 13px; }
.me { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ava { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: block; }
.ava-s { width: 28px; height: 28px; }
.ava-ph { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }

.wrap { flex: 1; min-height: 0; width: 100%; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; }

/* Список разделов — как диалоги в Telegram */
.dialogs { background: var(--card); margin: 16px 0; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.dlg { display: flex; gap: 12px; padding: 10px 14px; color: inherit; border-bottom: 1px solid var(--line); }
.dlg:last-child { border-bottom: 0; }
.dlg:hover { background: #FFF7F0; text-decoration: none; }
.dlg-icon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--orange); color: #fff; }
.dlg-icon .ic { width: 55%; height: 55%; }
.dlg-icon.sm { width: 38px; height: 38px; }
.dlg-icon.big { width: 84px; height: 84px; }
.dlg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.dlg-top, .dlg-bottom { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.dlg-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-time { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.dlg-last { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-author { color: var(--orange-d); font-weight: 600; }
.badge { background: var(--orange); color: #fff; border-radius: 11px; min-width: 22px; padding: 1px 7px; text-align: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.pin { font-size: 12px; flex-shrink: 0; }
.notice { background: #FFF4CC; padding: 10px 14px; border-bottom: 1px solid #f0e0a0; }

/* Чат */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; background: #fff; margin: 0; border-radius: 0; }
@media (min-width: 900px) { .chat { margin: 12px 0; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.back { font-size: 22px; padding: 0 6px; color: var(--muted); }
.chat-title { display: flex; flex-direction: column; min-width: 0; }
.chat-title span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-bar { display: block; padding: 6px 14px; background: #FFF7F0; border-bottom: 1px solid var(--line); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; flex-shrink: 0; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; background: #F6F1EC; }
.load-older { display: block; margin: 0 auto 10px; border: 0; background: #fff; padding: 6px 14px; border-radius: 14px; cursor: pointer; color: var(--orange-d); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.day { text-align: center; margin: 12px 0 8px; }
.day { color: #fff; display: table; margin-left: auto; margin-right: auto; background: rgba(0,0,0,.28); padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.msg { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.msg.cont { margin-top: 2px; }
.msg-ava { width: 36px; flex-shrink: 0; }
.msg.cont .msg-ava > *, .msg.cont .msg-head { display: none; }
.bubble { background: #fff; border-radius: 14px 14px 14px 4px; padding: 6px 10px 4px; max-width: min(78%, 560px); min-width: 120px; box-shadow: 0 1px 1px rgba(0,0,0,.08); overflow-wrap: anywhere; }
.msg.own .bubble { background: var(--own); }
.msg.system .bubble { max-width: 94%; border-left: 3px solid var(--orange); }
.msg.flash .bubble { animation: flash 1.8s; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px rgba(255,105,0,.55); } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.08); } }
.msg-head { display: flex; gap: 6px; align-items: baseline; }
.msg-name { font-weight: 700; color: var(--orange-d); font-size: 13px; }
.role { font-size: 10px; padding: 0 5px; border-radius: 8px; color: #fff; }
.role-admin { background: #E5287A; } .role-mod { background: #2f8f5b; }
.msg-text { white-space: pre-wrap; }
.reply { border-left: 3px solid var(--orange); background: rgba(255,105,0,.08); padding: 2px 8px; margin: 2px 0 4px; border-radius: 4px; cursor: pointer; font-size: 13px; display: flex; flex-direction: column; }
.reply span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.att-img { max-width: 260px; max-height: 260px; border-radius: 8px; cursor: zoom-in; object-fit: cover; background: #eee; }
.att-file { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,.05); border-radius: 8px; padding: 6px 10px; color: var(--text); max-width: 100%; }
.att-ico { font-size: 22px; }
.att-info { display: flex; flex-direction: column; min-width: 0; }
.att-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-info small { color: var(--muted); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.react { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 0 8px; cursor: pointer; font-size: 13px; }
.react.mine { background: #FFE2CC; border-color: var(--orange); }
.msg-foot { display: flex; justify-content: flex-end; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.more { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 2px; line-height: 1; }
.more:hover { color: var(--orange-d); }

/* Композер */
.composer { position: relative; border-top: 1px solid var(--line); background: #fff; padding: 8px 10px; flex-shrink: 0; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.composer.readonly { text-align: center; color: var(--muted); padding: 14px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 18px; padding: 8px 14px; font: inherit; max-height: 180px; outline: none; background: #F6F6F7; }
.composer textarea:focus { border-color: var(--orange); background: #fff; }
.attach { font-size: 22px; cursor: pointer; padding: 4px 6px; }
.send { border: 0; background: var(--orange); color: #fff; width: 40px; height: 36px; border-radius: 18px; cursor: pointer; font-size: 16px; flex-shrink: 0; }
.send:disabled { opacity: .6; }
.reply-bar { display: flex; justify-content: space-between; gap: 8px; border-left: 3px solid var(--orange); padding: 2px 8px; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.reply-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar button, .file-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.files:not(:empty) { margin-bottom: 6px; }
.file-chip { display: flex; align-items: center; gap: 6px; background: #F1F1F3; border-radius: 10px; padding: 3px 8px; max-width: 100%; }
.file-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; font-size: 12px; }
.to-bottom { position: absolute; right: 16px; bottom: 80px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: pointer; font-size: 18px; color: var(--orange-d); }

/* Меню, тосты, лайтбокс */
.menu { position: fixed; z-index: 50; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); padding: 6px; min-width: 210px; }
.menu-reacts { display: flex; justify-content: space-between; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-reacts button { border: 0; background: none; font-size: 20px; cursor: pointer; border-radius: 8px; padding: 2px 4px; }
.menu-reacts button:hover, .menu-item:hover { background: #FFF1E6; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.menu-item.danger { color: #c0262d; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #222; color: #fff; padding: 8px 16px; border-radius: 18px; z-index: 100; max-width: 90vw; }

/* Прочее */
.welcome { margin: auto; text-align: center; padding: 24px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.hint { color: var(--muted); font-size: 13px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 14px; cursor: pointer; font: inherit; }
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { text-decoration: none; background: var(--orange-d); }
.btn-lg { padding: 12px 24px; font-size: 16px; border-radius: 12px; }
.btn-danger { color: #c0262d; }
.page { background: #fff; margin: 16px 0; padding: 16px; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow-y: auto; }
.result { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.result-head { color: var(--muted); font-size: 12px; }
.admin-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-row input:not([type=checkbox]) { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; }
.grow { flex: 1; min-width: 140px; } .w-icon { width: 50px; text-align: center; } .w-num { width: 70px; } .w-slug { width: 150px; }
.slug { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
    .me-name, .top-nav .muted-link { display: none; }
    .search { max-width: none; }
    .bubble { max-width: 86%; }
    .att-img { max-width: 100%; }
}

/* SVG-иконки */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
.ic-xs { width: 14px; height: 14px; }
.inl { display: inline-flex; align-items: center; gap: 4px; }
.pin { display: inline-flex; color: var(--muted); }
.nav-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.2); color: #fff; border-radius: 16px; padding: 5px 12px; font-weight: 600; font-size: 13px; }
.nav-btn:hover { background: rgba(255,255,255,.32); text-decoration: none; }
.me { color: #fff; }
.me:hover { text-decoration: none; opacity: .9; }
a.msg-ava, a.msg-name { color: inherit; }
a.msg-name { color: var(--orange-d); }
a.msg-name:hover { text-decoration: underline; }
a.msg-ava:hover .ava { filter: brightness(.92); }
.back { display: inline-flex; }
.back .ic { width: 22px; height: 22px; }
.chat-head { cursor: pointer; }
.chat-head:hover { background: #FFF9F4; }
.chat-title { flex: 1; }
.head-info { color: var(--muted); display: inline-flex; }
.pinned-bar { display: flex; align-items: center; gap: 6px; }
.attach { display: inline-flex; color: var(--muted); }
.attach:hover { color: var(--orange-d); }
.attach .ic { width: 24px; height: 24px; }
.send { display: inline-flex; align-items: center; justify-content: center; }
.send .ic { width: 18px; height: 18px; }
.to-bottom { display: flex; align-items: center; justify-content: center; }
.more { display: inline-flex; }
.more .ic { width: 18px; height: 18px; }
.att-ico { display: inline-flex; color: var(--orange-d); }
.att-ico .ic { width: 24px; height: 24px; }
.foot-ico { display: inline-flex; align-items: center; }
.menu-item { display: flex; align-items: center; gap: 10px; }
.menu-item .ic { color: var(--muted); }
.menu-item.danger .ic { color: #c0262d; }
.reply-bar button, .file-chip button { display: inline-flex; }

/* эмодзи */
.emoji { width: 20px; height: 20px; vertical-align: -4px; margin: 0 1px; display: inline-block; }
.react .emoji { width: 16px; height: 16px; vertical-align: -3px; margin: 0; }
.menu-reacts .emoji { width: 24px; height: 24px; margin: 0; vertical-align: middle; }
.dlg-last .emoji, .pinned-bar .emoji { width: 16px; height: 16px; vertical-align: -3px; }
.emoji-pop { position: absolute; left: 8px; right: 8px; bottom: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 40; display: flex; flex-direction: column; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; height: 220px; overflow-y: auto; align-content: start; }
.emoji-grid button, .emoji-tabs button { border: 0; background: none; cursor: pointer; border-radius: 8px; padding: 3px; display: flex; align-items: center; justify-content: center; }
.emoji-grid button:hover, .emoji-tabs button:hover { background: #FFF1E6; }
.emoji-grid .emoji { width: 26px; height: 26px; margin: 0; }
.emoji-tabs { display: flex; gap: 2px; border-top: 1px solid var(--line); padding: 4px 6px; overflow-x: auto; }
.emoji-tabs button.active { background: #FFE2CC; }
.emoji-tabs .emoji { width: 20px; height: 20px; margin: 0; }

/* полноэкранная галерея */
body.no-scroll { overflow: hidden; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 90; display: flex; align-items: center; justify-content: center; }
.lightbox > img { max-width: 100vw; max-height: 100vh; width: auto; height: auto; object-fit: contain; user-select: none; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: linear-gradient(180deg, rgba(0,0,0,.6), transparent); color: #fff; z-index: 2; }
.lb-spacer { flex: 1; }
.lb-count { font-size: 14px; opacity: .9; }
.lb-btn { border: 0; background: rgba(255,255,255,.14); color: #fff; border-radius: 18px; min-width: 36px; height: 36px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; }
.lb-btn:hover { background: rgba(255,255,255,.28); text-decoration: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2; }
.lb-nav:hover { background: rgba(255,255,255,.28); }
.lb-nav .ic { width: 26px; height: 26px; }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
@media (max-width: 640px) { .lb-nav { width: 38px; height: 38px; } .lb-prev { left: 6px; } .lb-next { right: 6px; } }

/* панель информации */
.drawer { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: flex-end; }
.drawer-back { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.drawer-panel { position: relative; width: min(420px, 100%); background: #fff; display: flex; flex-direction: column; overflow-y: auto; box-shadow: -4px 0 24px rgba(0,0,0,.25); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 16px; position: sticky; top: 0; background: #fff; z-index: 2; border-bottom: 1px solid var(--line); }
.drawer-head button { border: 0; background: none; cursor: pointer; color: var(--muted); display: inline-flex; }
.info-top { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 16px 12px; text-align: center; }
.info-title { font-size: 20px; font-weight: 700; }
.info-desc { color: var(--muted); }
.tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 46px; background: #fff; z-index: 2; }
.tab { flex: 1; border: 0; background: none; padding: 10px 4px; cursor: pointer; font: inherit; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-bottom: 2px solid transparent; }
.tab i { font-style: normal; font-size: 12px; background: var(--bg); border-radius: 9px; padding: 0 6px; }
.tab.active { color: var(--orange-d); border-bottom-color: var(--orange); font-weight: 600; }
.tab-body.kind-photo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; }
.ph { border: 0; padding: 0; background: #eee; aspect-ratio: 1; cursor: pointer; overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; }
.ph:hover img { transform: scale(1.05); }
.row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; padding: 10px 6px 10px 16px; color: var(--text); }
.row-main:hover { background: #FFF7F0; text-decoration: none; }
.row-ic { color: var(--orange-d); width: 26px; height: 26px; }
.row-text { display: flex; flex-direction: column; min-width: 0; }
.row-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-go { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 10px 16px; display: inline-flex; }
.row-go:hover { color: var(--orange-d); }
.empty-note { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 0; }
.load-more { margin: 12px auto; }

/* карточка документа */
.doc-card { display: flex; gap: 10px; align-items: center; margin: 6px 0 2px; padding: 8px 10px; border-left: 3px solid var(--orange); background: rgba(255,105,0,.07); border-radius: 6px; color: var(--text); min-width: 220px; }
.doc-card:hover { background: rgba(255,105,0,.14); text-decoration: none; }
.doc-card.loading { min-height: 44px; opacity: .6; }
.doc-ic { width: 30px; height: 30px; color: var(--orange-d); }
.doc-info { display: flex; flex-direction: column; min-width: 0; }
.doc-info b { overflow: hidden; text-overflow: ellipsis; }
.doc-desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.doc-info small { color: var(--muted); }
.doc-page .doc-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.doc-page h2 { margin: 0 0 4px; }
.doc-desc-full { white-space: pre-wrap; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.doc-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.doc-preview img { max-width: 100%; border-radius: 8px; }
.doc-preview-text { background: #F6F6F7; padding: 12px; border-radius: 8px; overflow: auto; max-height: 60vh; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 8px; }
.w-sel { border: 1px solid var(--line); border-radius: 8px; padding: 6px; font: inherit; }
@media (max-width: 640px) { .nav-btn span { display: none; } .nav-btn { padding: 6px 8px; } }

/* ---- правки: композер, скролл, свои сообщения справа, компактные вложения ---- */
.attach { border: 0; background: none; padding: 0; width: 36px; height: 36px; cursor: pointer; align-items: center; justify-content: center; border-radius: 50%; }
.attach:hover { background: #FFF1E6; }
.attach:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.composer-row { align-items: flex-end; }
.send { padding: 0; width: 40px; height: 36px; display: flex; align-items: center; justify-content: center; }
.send .ic { display: block; width: 18px; height: 18px; }
.composer textarea { overflow-y: hidden; line-height: 20px; min-height: 36px; }

/* аккуратный скролл: тонкий, без стрелок */
.composer textarea, .msgs, .emoji-grid, .drawer-panel, .doc-preview-text, .files { scrollbar-width: thin; scrollbar-color: #cfd3d8 transparent; }
.composer textarea::-webkit-scrollbar, .msgs::-webkit-scrollbar, .emoji-grid::-webkit-scrollbar, .drawer-panel::-webkit-scrollbar, .doc-preview-text::-webkit-scrollbar, .files::-webkit-scrollbar { width: 6px; height: 6px; }
.composer textarea::-webkit-scrollbar-track, .msgs::-webkit-scrollbar-track, .emoji-grid::-webkit-scrollbar-track, .drawer-panel::-webkit-scrollbar-track, .files::-webkit-scrollbar-track { background: transparent; }
.composer textarea::-webkit-scrollbar-thumb, .msgs::-webkit-scrollbar-thumb, .emoji-grid::-webkit-scrollbar-thumb, .drawer-panel::-webkit-scrollbar-thumb, .doc-preview-text::-webkit-scrollbar-thumb, .files::-webkit-scrollbar-thumb { background: #cfd3d8; border-radius: 3px; }
.composer textarea::-webkit-scrollbar-thumb:hover, .msgs::-webkit-scrollbar-thumb:hover { background: #b3b8be; }
.composer textarea::-webkit-scrollbar-button, .msgs::-webkit-scrollbar-button, .emoji-grid::-webkit-scrollbar-button, .drawer-panel::-webkit-scrollbar-button, .doc-preview-text::-webkit-scrollbar-button, .files::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* свои сообщения — справа, как в Телеграме */
.msg.own { flex-direction: row-reverse; }
.msg.own .msg-ava, .msg.own .msg-head { display: none; }
.msg.own .bubble { border-radius: 14px 14px 4px 14px; }
.ticks { display: inline-flex; color: var(--muted); }
.ticks.seen { color: #2f9ae0; }
.role-custom { background: #6b7a90; }

/* вложения в сообщении: сетка миниатюр */
.atts.grid { display: grid; gap: 3px; }
.atts.g2 { grid-template-columns: repeat(2, 128px); }
.atts.g3 { grid-template-columns: repeat(3, 96px); }
.atts.g4 { grid-template-columns: repeat(4, 80px); }
.atts.grid .att-img { width: 100%; height: auto; aspect-ratio: 1; max-width: none; max-height: none; object-fit: cover; border-radius: 6px; }
.atts.grid .att-file { grid-column: 1 / -1; }
.att-file { padding: 4px 10px; gap: 6px; }
.att-ico .ic { width: 22px; height: 22px; }

/* вложения в композере: одна компактная лента */
.files { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; align-items: center; gap: 8px; padding: 6px 4px 2px 2px; }
.files:not(:empty) { margin-bottom: 6px; }
.file-chip { position: relative; flex-shrink: 0; height: 48px; padding: 0 10px; max-width: 160px; border-radius: 10px; }
.file-chip.is-img { width: 48px; padding: 0; }
.file-chip img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.file-chip .att-ico .ic { width: 20px; height: 20px; }
.file-name { max-width: 100px; }
.chip-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; border-radius: 50%; background: #555 !important; color: #fff !important; display: flex !important; align-items: center; justify-content: center; }
.chip-x .ic { width: 10px; height: 10px; }
.files-sum { flex-shrink: 0; color: var(--muted); font-size: 12px; padding-left: 4px; white-space: nowrap; }

/* участники */
.row.member .row-main .ava { width: 38px; height: 38px; }
.row.member .role { margin-left: 4px; }

/* онлайн и реакции */
.ava-wrap { position: relative; display: block; width: 36px; height: 36px; flex-shrink: 0; }
.row.member .ava-wrap { width: 38px; height: 38px; }
.ava-wrap .ava { width: 100%; height: 100%; }
.online-dot { display: none; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #3cc75c; border: 2px solid #fff; box-sizing: border-box; }
.ava-wrap.is-online .online-dot { display: block; }
.status-on { color: #2e9e4f !important; font-weight: 600; }
.menu-reacts { align-items: center; }
.react-plus { border: 0; background: #F1F1F3 !important; border-radius: 50% !important; width: 28px; height: 28px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.react-plus:hover { background: #FFE2CC !important; color: var(--orange-d); }
.react-plus .ic { width: 16px; height: 16px; }
.emoji-pop.floating { position: fixed; bottom: auto; right: auto; width: 340px; max-width: calc(100vw - 16px); z-index: 80; }

/* индикатор перехода */
#navbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: #fff; box-shadow: 0 0 6px rgba(255,255,255,.9); z-index: 200; opacity: 0; transition: width .35s ease, opacity .25s ease; pointer-events: none; }
