/* «💬 Сообщения» ролей (задача главного #215, account/MSG-PLAN.md): окно сообщений — страница /account/messages.html, окно поверх игры и
   разделы панели главного («💬 Мои диалоги», «👁 Переписки ролей»). Вид — по макетам site/mockups/msg-*.html (msg-kit.css), все правила под
   .s4m, чтобы не задеть стили страницы, куда окно встроено (панель). Сообщения — как в задачах (thread.css): полоса цвета позывного, аватар. */
.s4m { --bg: #0b1120; --bg2: #111a2e; --card: #131d33; --line: #22304d; --text: #e2e8f0; --muted: #94a3b8; --accent: #4ade80; --max: #2f6bff; color: var(--text); font: 15px/1.5 system-ui, "Segoe UI", Roboto, sans-serif; }
.s4m *, .s4m *::before, .s4m *::after { box-sizing: border-box; }
.s4m button { font: inherit; color: inherit; }
.s4m h2, .s4m h3 { color: var(--text); }
.s4m .btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.s4m .btn:hover { border-color: #475569; }
.s4m .btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 9px; }
.s4m .btn.ghost { background: transparent; }
.s4m .btn.danger { border-color: rgba(248,113,113,.5); color: #fecaca; }
.s4m .btn.danger:hover { border-color: #f87171; }
.s4m .btn:disabled { opacity: .5; cursor: default; }
.s4m .btn.main, .s4m .btn.send { display: inline-grid; grid-template-columns: auto auto; align-items: center; justify-content: center; column-gap: 9px; row-gap: 0; text-align: left; line-height: 1.25; }
.s4m .btn.main { background: #f1f5f9; color: #0f172a; border: 1px solid #f1f5f9; font-weight: 800; padding-left: 8px; }
.s4m .btn.main:hover:not(:disabled) { background: #fff; border-color: #fff; box-shadow: 0 0 0 3px rgba(241,245,249,.18); }
.s4m .btn.main::before, .s4m .btn.send::before { content: attr(data-ic); grid-column: 1; grid-row: 1 / span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #16a34a; color: #fff; font-size: 14px; font-weight: 800; line-height: 1; }
.s4m .btn.main:not([data-ic])::before { content: '✓'; }
.s4m .btn.main[data-ic]:not([data-ic="✓"]):not([data-ic="＋"]):not([data-ic="▶"])::before { background: #dcfce7; color: #0f172a; font-size: 15px; }
.s4m .btn.main::after, .s4m .btn.send::after { content: attr(data-sub); grid-column: 2; grid-row: 2; font-size: 11.5px; font-weight: 500; color: #475569; line-height: 1.25; }
.s4m .btn.main:not([data-sub])::after, .s4m .btn.send:not([data-sub])::after { display: none; }
.s4m .btn.main:not([data-sub])::before, .s4m .btn.send:not([data-sub])::before { grid-row: 1; }
.s4m .btn.main.sm::before, .s4m .btn.send.sm::before { width: 22px; height: 22px; font-size: 12px; }
.s4m .btn.main:disabled { background: transparent; color: #94a3b8; border: 1px dashed #475569; font-weight: 700; }
.s4m .btn.main:disabled::before { background: #334155 !important; color: #cbd5e1 !important; }
.s4m .btn.send { background: transparent; color: #f1f5f9; border: 1px solid #64748b; padding-left: 8px; font-weight: 700; }
.s4m .btn.send:hover:not(:disabled) { border-color: #f1f5f9; }
.s4m .btn.send::before { background: #0284c7; color: #fff; font-size: 13px; }
.s4m .btn.send:not([data-ic])::before { content: '✉'; }
.s4m .btn.send::after { color: #94a3b8; }
.s4m .btn.send:disabled { opacity: .5; cursor: default; }
.s4m .av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; line-height: 0; position: relative; }
.s4m .av svg { display: block; }
.s4m .av.em { font-size: 14px; line-height: 1; }
.s4m .av.root { background: #3b2a06; box-shadow: inset 0 0 0 2px #f59e0b; }
.s4m .av.grp { background: #12304a; box-shadow: inset 0 0 0 2px #38bdf8; }
.s4m .av.gen { background: #10321f; box-shadow: inset 0 0 0 2px #4ade80; }
.s4m .ub { position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font: 800 11px/18px system-ui; text-align: center; border: 2px solid #0b1120; box-sizing: content-box; z-index: 2; }
.s4m .ub.pop { animation: s4m-ubPop .5s ease; }
@keyframes s4m-ubPop{0% { transform: scale(.4); } 55% { transform: scale(1.35); } 100% { transform: scale(1); }}
@keyframes s4m-ringP{0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 50% { box-shadow: 0 0 0 5px rgba(239,68,68,0); }}
@media (prefers-reduced-motion: reduce) {
.s4m .ub.pop { animation: s4m-none; }
}
.s4m .mx { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 640px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; position: relative; }
.s4m .mx.rail { grid-template-columns: 64px 290px minmax(0, 1fr); }
.s4m .mx.withMem { grid-template-columns: 320px minmax(0, 1fr) 250px; }
.s4m .mx.rail.withMem { grid-template-columns: 64px 290px minmax(0, 1fr) 250px; }
.s4m .mx-rail { background: #0d1527; border-right: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; overflow-y: auto; }
.s4m .mx-rail button { position: relative; width: 46px; height: 46px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg2); font-size: 21px; cursor: pointer; transition: border-radius .15s; }
.s4m .mx-rail button.on { border-radius: 12px; border-color: #f1f5f9; background: #1e293b; }
.s4m .mx-rail button:hover { border-radius: 12px; }
.s4m .mx-rail button .ub { top: -5px; right: -5px; }
.s4m .mx-rail .sep { width: 30px; height: 1px; background: var(--line); }
.s4m .mx-rail button.on::before { content: ''; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: #f1f5f9; }
.s4m .mx-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #0f172a; }
.s4m .mx-lh { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.s4m .mx-lh .ttl { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }
.s4m .mx-lh .ttl .sp { margin-left: auto; display: flex; gap: 6px; }
.s4m .mx-search { width: 100%; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: #0d1426; color: var(--text); font: inherit; font-size: 14px; }
.s4m .mx-search:focus, .s4m .mx-in:focus, .s4m .fld:focus { outline: none; border-color: #64748b; }
.s4m .mx-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.s4m .mx-tabs button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.s4m .mx-tabs button.on { background: #f1f5f9; color: #0f172a; border-color: #f1f5f9; }
.s4m .mx-tabs button .c { min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 10.5px; line-height: 17px; text-align: center; }
.s4m .mx-scroll { overflow-y: auto; flex: 1; min-height: 0; padding: 4px 0 10px; }
.s4m .mx-gh { display: flex; align-items: center; gap: 7px; padding: 10px 12px 4px; font-size: 12px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; user-select: none; }
.s4m .mx-gh .rl { text-transform: none; letter-spacing: 0; font-weight: 700; }
.s4m .mx-gh .chev { margin-left: auto; transition: transform .2s; }
.s4m .mx-gh.shut .chev { transform: rotate(-90deg); }
.s4m .mx-gh .c { min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 10.5px; line-height: 17px; text-align: center; letter-spacing: 0; }
.s4m .mx-it { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 12px; border: 0; border-left: 3px solid transparent; background: none; text-align: left; cursor: pointer; }
.s4m .mx-it:hover { background: #131d33; }
.s4m .mx-it.on { background: #1a2742; border-left-color: #f1f5f9; }
.s4m .mx-it .tx { flex: 1; min-width: 0; }
.s4m .mx-it .r1 { display: flex; gap: 6px; align-items: baseline; }
.s4m .mx-it .r1 b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4m .mx-it .r1 time { margin-left: auto; font-size: 11.5px; color: #64748b; flex: none; }
.s4m .mx-it .r2 { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.s4m .mx-it .r2 span.last { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4m .mx-it .cnt { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; line-height: 19px; text-align: center; flex: none; }
.s4m .mx-it .cnt.mute { background: #475569; }
.s4m .mx-it .mt { font-size: 11px; }
.s4m .rtag { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid; white-space: nowrap; line-height: 17px; }
.s4m .rtag.tester { color: #fecaca; border-color: rgba(248,113,113,.5); }
.s4m .rtag.editor { color: #bbf7d0; border-color: rgba(74,222,128,.5); }
.s4m .rtag.admin { color: #ddd6fe; border-color: rgba(167,139,250,.6); }
.s4m .rtag.root { color: #fde68a; border-color: rgba(245,158,11,.6); }
.s4m .mx-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.s4m .mx-ch { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: #111a2e; min-height: 56px; }
.s4m .mx-ch .tx { flex: 1; min-width: 0; }
.s4m .mx-ch .tx b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4m .mx-ch .tx small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4m .mx-ch .acts { display: flex; gap: 6px; flex: none; }
.s4m .iconb.mx-back { display: none; }
.s4m .iconb { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-size: 16px; display: inline-grid; place-items: center; position: relative; }
.s4m .iconb:hover { border-color: #64748b; }
.s4m .iconb.on { border-color: #f1f5f9; background: #1e293b; }
.s4m .mx-body { flex: 1; overflow-y: auto; padding: 8px 14px 6px; min-height: 0; }
.s4m .mx-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 20px; }
.s4m .daysep { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; color: #64748b; font-size: 12px; font-weight: 700; }
.s4m .daysep::before, .s4m .daysep::after { content: ''; flex: 1; height: 1px; background: #22304d; }
/* новое в беседе (#215 [84], макет msg-notify.html, cv=2): яркая пилюля «N новых сообщений» на красной линии; новые чужие —
   подсвечены, подсветка гаснет плавно (класс fade через 3,5 с, messages.js); пришли, пока прокручено вверх, — «↓ N новых» внизу */
.s4m .newsep { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; font-size: 12px; font-weight: 800; }
.s4m .newsep::before, .s4m .newsep::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, #f43f5e); }
.s4m .newsep::after { background: linear-gradient(90deg, #f43f5e, transparent); }
.s4m .newsep span { padding: 3px 12px; border-radius: 999px; background: linear-gradient(#fb7185, #e11d48); color: #fff; font-size: 12.5px; font-weight: 900; box-shadow: 0 0 14px rgba(244,63,94,.5); white-space: nowrap; }
.s4m .m.nw { background: rgba(244,63,94,.16); border-color: rgba(251,113,133,.7); }
.s4m .m.nw.fade { background: var(--bg2); border-color: var(--line); transition: background 2.5s ease, border-color 2.5s ease; }
.s4m .m.me.nw.fade { background: #142640; border-color: #24406a; }
.s4m .mx-jump { position: sticky; bottom: 4px; z-index: 4; display: block; margin: 0 auto; width: max-content; padding: 5px 14px; border-radius: 999px; border: 0; background: #e11d48; color: #fff; font: 800 13px system-ui, sans-serif; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.s4m .mx-jump:hover { background: #f43f5e; }
@media (prefers-reduced-motion: reduce) { .s4m .m.nw.fade { transition: none; } }
.s4m .m { position: relative; padding: 8px 12px 8px 48px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); margin: 7px 0; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.s4m .m::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 38px; border-radius: 11px 0 0 11px; background: color-mix(in srgb, var(--c) 22%, transparent); border-right: 2px solid var(--c); pointer-events: none; }
.s4m .m > .mav { position: absolute; left: 6px; top: 8px; z-index: 1; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; line-height: 0; }
.s4m .m > .mav svg { width: 26px; height: 26px; }
.s4m .m > .mav.root { background: #3b2a06; box-shadow: inset 0 0 0 2px #f59e0b; }
.s4m .m > .mav .em, .s4m .m > .mav.em { font-size: 14px; line-height: 1; }
.s4m .m small.h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-bottom: 2px; white-space: normal; }
.s4m .m small.h .mnm { color: #e2e8f0; font-weight: 700; }
.s4m .m small.h time { margin-left: auto; }
.s4m .m .rd { display: block; text-align: right; font-size: 11.5px; color: #64748b; margin-top: 2px; }
.s4m .m .rd.ok { color: #7dd3fc; }
.s4m .m.me { background: #142640; border-color: #24406a; }
.s4m .own-right .m.me { margin-left: 18%; }
.s4m .own-right .m:not(.me):not(.sys) { margin-right: 18%; }
.s4m .m.sys { padding: 2px 12px; background: none; border: 0; text-align: center; color: var(--muted); font-size: 13px; }
.s4m .m.sys::before { display: none; }
.s4m .m.cont { margin-top: -3px; }
.s4m .m.cont small.h { display: none; }
.s4m .m.cont > .mav { display: none; }
.s4m .m .act { display: flex; gap: 6px; margin-top: 6px; white-space: normal; flex-wrap: wrap; }
@media (hover: hover) {
.s4m .m .act { display: none; position: absolute; right: 8px; bottom: -12px; margin: 0; z-index: 3; }
.s4m .m:hover .act { display: flex; }
.s4m .m .act button { background: #0f172a; }
}
.s4m .m:last-child { margin-bottom: 14px; }
.s4m .m .act button { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.s4m .m .act button:hover { color: #e2e8f0; border-color: #64748b; }
.s4m .m.flash { animation: s4m-mflash 1.6s ease; }
@keyframes s4m-mflash{0% { box-shadow: 0 0 0 2px rgba(96,165,250,.8); } 100% { box-shadow: 0 0 0 0 rgba(96,165,250,0); }}
.s4m .typing { color: var(--muted); font-size: 13px; padding: 2px 4px 6px; min-height: 24px; }
.s4m .typing i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #94a3b8; margin: 0 1px; animation: s4m-tdot 1s infinite; }
.s4m .typing i:nth-child(2) { animation-delay: .15s; }
.s4m .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes s4m-tdot{0%, 100% { opacity: .25; } 50% { opacity: 1; }}
.s4m mark { background: rgba(250,204,21,.35); color: #fff; border-radius: 3px; padding: 0 1px; }
.s4m .poll { display: block; margin: 6px 0 2px; padding: 10px 12px; border-radius: 12px; background: rgba(56,189,248,.06); border: 1px solid rgba(56,189,248,.35); white-space: normal; }
.s4m .poll .q { font-weight: 800; font-size: 15px; margin-bottom: 2px; }
.s4m .poll .meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.s4m .poll .meta span { padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); }
.s4m .poll .opt { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; margin: 5px 0; border-radius: 10px; border: 1px solid #2b3a5c; background: #0d1426; cursor: pointer; text-align: left; overflow: hidden; font-size: 14px; }
.s4m .poll .opt:hover:not(:disabled) { border-color: #7dd3fc; }
.s4m .poll .opt:disabled { cursor: default; }
.s4m .poll .opt .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(56,189,248,.18); transition: width .45s ease; z-index: 0; }
.s4m .poll .opt.mine .fill { background: rgba(56,189,248,.32); }
.s4m .poll .opt > *:not(.fill) { position: relative; z-index: 1; }
.s4m .poll .opt .ck { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #64748b; display: grid; place-items: center; font-size: 10px; font-weight: 900; color: transparent; flex: none; }
.s4m .poll.multi .opt .ck { border-radius: 5px; }
.s4m .poll .opt.sel .ck, .s4m .poll .opt.mine .ck { background: #0284c7; border-color: #0284c7; color: #fff; }
.s4m .poll .opt .ot { flex: 1; min-width: 0; }
.s4m .poll .opt .pc { font-weight: 800; color: #bae6fd; font-variant-numeric: tabular-nums; }
.s4m .poll .who { display: flex; gap: 2px; margin-left: 4px; }
.s4m .poll .who .av { width: 18px; height: 18px; }
.s4m .poll .who svg { width: 18px; height: 18px; }
.s4m .poll .foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.s4m .poll .foot .sp { margin-left: auto; display: flex; gap: 6px; }
.s4m .poll.cards .opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.s4m .poll.cards .opt { flex-direction: column; align-items: stretch; margin: 0; padding: 10px; min-height: 84px; }
.s4m .poll.cards .opt .fill { top: auto; height: 6px; bottom: 0; }
.s4m .poll.cards .opt .pc { font-size: 20px; }
.s4m .poll.cards .opt .ck { position: absolute; right: 8px; top: 8px; }
.s4m .poll.cards .opt .ot { font-weight: 700; padding-right: 22px; }
.s4m .poll.closed { border-color: #334155; background: rgba(51,65,85,.15); }
.s4m .mx-comp { border-top: 1px solid var(--line); padding: 8px 12px 10px; background: #0f172a; }
.s4m .mx-comp .row { display: flex; gap: 8px; align-items: flex-end; }
.s4m .mx-in { flex: 1; min-width: 0; min-height: 42px; max-height: 140px; resize: none; padding: 9px 11px; border-radius: 11px; border: 1px solid var(--line); background: #0d1426; color: var(--text); font: inherit; font-size: 14.5px; }
.s4m .mx-comp .sub { display: flex; gap: 10px; align-items: center; margin-top: 5px; font-size: 11.5px; color: #64748b; flex-wrap: wrap; }
.s4m .mx-comp .sub .cnt { margin-left: auto; }
.s4m .mx-comp .sub .cnt.warn { color: #fde68a; }
.s4m .mx-comp .sub .cnt.bad { color: #fca5a5; }
.s4m .mx-comp .ro { padding: 9px 12px; border-radius: 10px; border: 1px dashed #475569; color: var(--muted); font-size: 13.5px; text-align: center; }
.s4m .mx-mem { border-left: 1px solid var(--line); background: #0f172a; display: flex; flex-direction: column; min-height: 0; }
.s4m .mx-mem .hh { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 800; display: flex; align-items: center; gap: 6px; }
.s4m .mx-mem .hh .sp { margin-left: auto; }
.s4m .mx-mem .ls { overflow-y: auto; padding: 6px 0; flex: 1; }
.s4m .mx-mem .p { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13.5px; }
.s4m .mx-mem .p .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4m .mx-mem .p .x { opacity: .0; }
.s4m .mx-mem .p:hover .x { opacity: 1; }
.s4m .mx-mem .on-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex: none; }
.s4m .mx-mem .on-dot.off { background: #334155; }
.s4m .mx.solo, .s4m .mx.solo.withMem { grid-template-columns: minmax(0, 1fr); }
.s4m .mx.solo.withMem { grid-template-columns: minmax(0, 1fr) 250px; }
.s4m .mx.solo .mx-list, .s4m .mx.solo .mx-rail, .s4m .mx.solo .mx-back { display: none !important; }
.s4m .mx.solo .mx-chat { display: flex !important; }
.s4m .ov { position: fixed; inset: 0; background: rgba(2,6,23,.66); display: grid; place-items: center; z-index: 100; padding: 16px; animation: s4m-ovIn .15s ease; }
@keyframes s4m-ovIn{from { opacity: 0; }}
.s4m .dlg { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); border: 1px solid #2b3a5c; border-radius: 16px; padding: 16px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.s4m .dlg h3 { margin: 0 0 10px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.s4m .dlg h3 .x { margin-left: auto; }
.s4m .dlg .foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.s4m .drawer { border-radius: 0 16px 16px 0; position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--card); border-left: 1px solid #2b3a5c; z-index: 20; padding: 14px 16px; overflow-y: auto; box-shadow: -14px 0 40px rgba(0,0,0,.45); animation: s4m-drIn .22s ease; }
@keyframes s4m-drIn{from { transform: translateX(40px); opacity: 0; }}
.s4m .drawer h3 { margin: 0 0 10px; font-size: 17px; display: flex; gap: 8px; align-items: center; }
.s4m .drawer h3 .x { margin-left: auto; }
.s4m .drawer .foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.s4m .lbl { display: block; font-size: 12.5px; font-weight: 800; color: #94a3b8; margin: 10px 0 4px; }
.s4m .fld { width: 100%; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: #0d1426; color: var(--text); font: inherit; font-size: 14.5px; }
.s4m .hint { color: #64748b; font-size: 12px; margin-top: 3px; }
.s4m .chk { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; cursor: pointer; user-select: none; font-size: 14px; }
.s4m .chk:hover { background: #111a2e; }
.s4m .chk input { width: 17px; height: 17px; accent-color: #0284c7; flex: none; }
.s4m .chk .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4m .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.s4m .chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: #cbd5e1; font-size: 13px; font-weight: 700; cursor: pointer; user-select: none; }
.s4m .chip.on { background: rgba(2,132,199,.22); border-color: #0284c7; color: #fff; }
.s4m .optrow { display: flex; gap: 6px; align-items: center; margin: 5px 0; }
.s4m .optrow .n { width: 22px; color: #64748b; font-size: 12.5px; text-align: right; flex: none; }
.s4m .steps { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.s4m .steps i { font-style: normal; font-size: 12.5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.s4m .steps i.cur { background: #f1f5f9; color: #0f172a; border-color: #f1f5f9; font-weight: 800; }
.s4m .steps i.done { color: #86efac; border-color: rgba(74,222,128,.4); }
.s4m .sw { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid rgba(34,48,77,.7); cursor: pointer; user-select: none; }
.s4m .sw:first-child { border-top: 0; }
.s4m .sw .tx { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; }
.s4m .sw .tx small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; line-height: 1.35; }
.s4m .mini { flex: none; width: 38px; height: 21px; border-radius: 999px; background: #334155; position: relative; transition: background .15s; }
.s4m .mini::after { content: ''; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #e2e8f0; transition: left .15s; }
.s4m .on > .mini, .s4m .mini.on { background: var(--max); }
.s4m .on > .mini::after, .s4m .mini.on::after { left: 20px; }
.s4m .box { border: 1px solid var(--line); border-radius: 14px; background: rgba(15,23,42,.55); }
.s4m .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.s4m .toastw { position: fixed; right: 16px; top: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); pointer-events: none; }
.s4m .toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 13px; background: #131d33; border: 1px solid #2b3a5c; box-shadow: 0 12px 30px rgba(0,0,0,.5); animation: s4m-tIn .25s ease; cursor: pointer; font-size: 13.5px; }
.s4m .toast .tx { flex: 1; min-width: 0; }
.s4m .toast .tx b { display: block; }
.s4m .toast .tx span { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes s4m-tIn{from { transform: translateY(-10px); opacity: 0; }}
@media (max-width: 860px) {
.s4m .mx, .s4m .mx.rail, .s4m .mx.withMem, .s4m .mx.rail.withMem { grid-template-columns: minmax(0, 1fr); height: var(--mxhm, 600px); }
.s4m .mx-comp .sub .kh { display: none; }
.s4m .mx.rail { grid-template-columns: 56px minmax(0, 1fr); }
.s4m .mx.rail.withMem { grid-template-columns: 56px minmax(0, 1fr); }
.s4m .mx-rail button { width: 42px; height: 42px; }
.s4m .mx.open .mx-list { display: none; }
.s4m .mx:not(.open) .mx-chat { display: none; }
.s4m .mx.rail.open .mx-rail { display: none; }
.s4m .mx.rail.open { grid-template-columns: minmax(0, 1fr); }
.s4m .mx-mem { position: absolute; inset: 0; z-index: 15; }
.s4m .iconb.mx-back { display: inline-grid; }
.s4m .own-right .m.me { margin-left: 8%; }
.s4m .own-right .m:not(.me):not(.sys) { margin-right: 8%; }
}
@media (max-width: 480px) {
.s4m .mx-ch .acts .wide { display: none; }
.s4m .m { font-size: 14px; }
.s4m .poll.cards .opts { grid-template-columns: 1fr 1fr; }
}

/* ---- своё (не из макета) ---- */
.s4m .mx { height: var(--mxh, 640px); }
.s4m .mx-it .r2 .rtag { flex: none; }
.s4m .more { display: block; margin: 6px auto; }
.s4m .m .q { display: block; border-left: 3px solid #475569; padding: 2px 8px; margin: 2px 0 4px; color: var(--muted); font-size: 13px; white-space: normal; cursor: pointer; }
.s4m .m .gone { opacity: .6; }
.s4m .msgerr { color: #fca5a5; font-size: 12.5px; margin-top: 4px; }
.s4m .banbar { padding: 8px 12px; border-radius: 12px; border: 1px dashed rgba(248,113,113,.55); background: rgba(248,113,113,.07); color: #fecaca; font-size: 13.5px; margin: 0 0 8px; }
.s4m .wbanner { padding: 8px 12px; border-radius: 12px; border: 1px dashed rgba(245,158,11,.55); background: rgba(245,158,11,.07); color: #fde68a; font-size: 13.5px; margin-bottom: 10px; }
.s4m .ntfpop { position: absolute; right: 12px; top: 54px; z-index: 30; width: min(320px, calc(100% - 24px)); background: var(--card); border: 1px solid #2b3a5c; border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5); overflow: hidden; }
.s4m .ntfpop .ph { padding: 9px 12px; font-weight: 800; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.s4m .ntfpop .ph .x { margin-left: auto; width: 28px; height: 28px; font-size: 13px; }
.s4m .sw.dis { opacity: .5; cursor: default; }
.s4m .sndrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 4px 12px 10px; }
.s4m .sndrow select, .s4m .sndrow input[type=range] { accent-color: var(--max); }
.s4m .sndrow select { padding: 5px 8px; border-radius: 9px; border: 1px solid var(--line); background: #0d1426; color: var(--text); font: inherit; font-size: 13.5px; }
.s4m .mx-empty small { color: #64748b; }
/* раздел главного «👁 Переписки ролей» */
.s4m .kpis { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.s4m .kpi { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); min-width: 120px; }
.s4m .kpi b { display: block; font-size: 20px; } .s4m .kpi small { color: var(--muted); font-size: 12px; }
.s4m .bar2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; } .s4m .bar2 .mx-search { max-width: 380px; flex: 1; min-width: 180px; }
.s4m .res { border: 1px solid var(--line); border-radius: 14px; background: var(--card); margin: 0 0 12px; overflow: hidden; }
.s4m .res .hh { padding: 8px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.s4m .res .it { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-top: 1px solid rgba(34,48,77,.6); cursor: pointer; }
.s4m .res .it:hover { background: #1a2742; } .s4m .res .it .tx { flex: 1; min-width: 0; font-size: 13.5px; word-break: break-word; } .s4m .res .it .tx small { display: block; color: var(--muted); font-size: 12px; }
.s4m .res .b { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); } .s4m .res .b .tx { flex: 1; min-width: 0; font-size: 13.5px; } .s4m .res .b .tx small { display: block; color: var(--muted); }
.s4m .pcard { display: flex; gap: 12px; align-items: center; } .s4m .pcard .av svg { width: 54px; height: 54px; }
.s4m .tagw { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fde68a; border: 1px solid rgba(245,158,11,.6); }
.s4m .h2 { margin: 0 0 4px; font-size: 21px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .s4m .sub0 { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
/* «⋯» беседы: удалить у себя, выйти, удалить чат (#215 [39]) */
.s4m .actpop .actit { display: block; width: 100%; text-align: left; padding: 9px 12px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--text, #e2e8f0); cursor: pointer; font: inherit; }
.s4m .actpop .actit:first-of-type { border-top: 0; }
.s4m .actpop .actit:hover, .s4m .actpop .actit:focus-visible { background: #1a2742; outline: none; }
.s4m .actpop .actit b { display: block; font-size: 14px; }
.s4m .actpop .actit small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.s4m .actpop .actit.danger b { color: #fca5a5; }
/* ник и аватар участника — щелчок открывает личную беседу (#215 [36]) */
.s4m .mx-mem .p .pm { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.s4m [data-pm] { cursor: pointer; outline: none; }
.s4m .mx-mem .p .pm[data-pm]:hover .nm, .s4m .mx-mem .p .pm[data-pm]:focus-visible .nm, .s4m .m small.h .mnm[data-pm]:hover, .s4m .m small.h .mnm[data-pm]:focus-visible { text-decoration: underline; text-underline-offset: 3px; color: #7dd3fc; }
.s4m .m > .mav[data-pm]:hover, .s4m .m > .mav[data-pm]:focus-visible, .s4m .mx-mem .p .pm[data-pm]:hover .av, .s4m .mx-mem .p .pm[data-pm]:focus-visible .av { box-shadow: 0 0 0 2px #7dd3fc; border-radius: 50%; }
/* вложения в сообщении (#215 [57]): миниатюры постоянной высоты — пришедшая картинка не сдвигает прокрутку беседы; звук — проигрыватель
   задач (.aud в thread.css), лоток у поля — .itray там же */
.s4m .m .mf { display: flex; flex-wrap: wrap; gap: 6px; margin: 5px 0 2px; white-space: normal; }
.s4m .m .mf .mimg { height: 150px; width: auto; max-width: min(260px, 100%); min-width: 60px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); background: #0b1120; cursor: zoom-in; display: block; }
.s4m .m .mf .mfa { display: block; width: 100%; max-width: 420px; }
.s4m .m .mf .mfa .aud { max-width: none; }
.s4m .mx-comp .tools { display: contents; }
.s4m .mx-comp .itray { margin: 6px 0 0; }
.s4m .mx-it .cnt { margin: 0; }

/* ---- «в сети» (#215 [75], макет site/mockups/msg-presence.html: presence v=A pos=name off=none pulse=1) ----
   зелёная точка справа от ника в списке бесед, мягкое «дыхание» кольцом ~2,2 с (без мерцания), появляется и гаснет плавно;
   не в сети — точки нет (места не занимает); в шапке — время присутствия справа от ника; в «👥 Участники» — точка и время */
.s4m .pd { --pd: 11px; position: relative; display: inline-block; width: var(--pd); height: var(--pd); border-radius: 50%; background: #22c55e; flex: none;
  box-shadow: 0 0 0 0 rgba(34,197,94,.55); transition: opacity .6s ease, transform .6s ease, width .6s ease, margin .6s ease, background-color .6s ease; vertical-align: middle; cursor: default; }
.s4m .pd.live { animation: s4p-pulse 2.2s ease-in-out infinite; }
.s4m .pd.hide { opacity: 0; transform: scale(.2); animation: none; }
.s4m .nmw .pd.hide, .s4m .pres .pd.hide { width: 0; margin-left: -7px; }
.s4m .mx-mem .p .pd.hide { width: 0; margin-left: -8px; }
@keyframes s4p-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@media (prefers-reduced-motion: reduce) { .s4m .pd.live { animation: none; box-shadow: 0 0 0 2px rgba(34,197,94,.35); } .s4m .pd { transition: none; } }
.s4m .mx-it .r1 .nmw { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.s4m .mx-it .r1 .nmw b { min-width: 0; }
.s4m .mx-ch .nmrow { display: flex; align-items: center; gap: 9px; min-width: 0; }
.s4m .mx-ch .nmrow b { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s4m .pres { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; flex: none; transition: color .6s; }
.s4m .pres.on { color: #86efac; font-weight: 700; }
.s4m .pres .pd { --pd: 9px; }
.s4m .mx-mem .p .seen { display: block; font-size: 11.5px; color: #64748b; }
.s4m .mx-mem .p .seen.on { color: #86efac; }
.s4m .grpon { color: #86efac; font-weight: 700; }
.s4m-ptip { position: fixed; z-index: 400; pointer-events: none; padding: 5px 10px; border-radius: 9px; background: #f1f5f9; color: #0f172a; font: 700 12.5px/1.3 system-ui, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 6px 18px rgba(0,0,0,.45); opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; white-space: nowrap; }
.s4m-ptip.on { opacity: 1; transform: none; }
.s4m-ptip::after { content: ''; position: absolute; left: var(--ax, 50%); top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: #f1f5f9; }
.s4m-ptip .g { color: #15803d; } .s4m-ptip small { display: block; font-weight: 500; color: #475569; }
@media (max-width: 480px) { .s4m .pres { font-size: 11.5px; } }
