/* ===== СОПС чат ===== */
#sops-chat-fab{position:fixed;right:18px;bottom:18px;z-index:9000;width:52px;height:52px;border-radius:50%;
  border:none;background:#2f6fed;color:#fff;font-size:22px;cursor:pointer;box-shadow:0 4px 14px rgba(0,0,0,.28);
  display:flex;align-items:center;justify-content:center;transition:transform .15s}
#sops-chat-fab:hover{transform:scale(1.06)}
#sops-chat-fab .badge{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 4px;border-radius:9px;
  background:#e23b3b;color:#fff;font-size:11px;line-height:18px;font-weight:700;text-align:center}
#sops-chat-fab .badge:empty,#sops-chat-fab .badge[data-n="0"]{display:none}

#sops-chat{position:fixed;top:0;right:0;height:100%;width:380px;max-width:100vw;z-index:9001;
  background:var(--chat-bg,#fff);color:var(--chat-fg,#1a1a1a);display:flex;flex-direction:column;
  box-shadow:-6px 0 24px rgba(0,0,0,.22);transform:translateX(100%);transition:transform .2s ease}
#sops-chat.open{transform:translateX(0)}
html[data-theme="dark"] #sops-chat,body.dark #sops-chat{--chat-bg:#1e1f22;--chat-fg:#e6e6e6}

#sops-chat header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid rgba(128,128,128,.25);font-weight:600}
#sops-chat header .sp{flex:1}
#sops-chat header button{background:none;border:none;color:inherit;font-size:18px;cursor:pointer;opacity:.75}
#sops-chat header button:hover{opacity:1}

#sops-chat .msgs{flex:1;overflow-y:auto;padding:10px 12px;display:flex;flex-direction:column;gap:9px}
#sops-chat .m{font-size:13.5px;line-height:1.4;position:relative}
#sops-chat .m .meta{font-size:11.5px;opacity:.7;margin-bottom:1px;display:flex;flex-wrap:wrap;align-items:center;gap:5px}
#sops-chat .m .nick{font-weight:600;opacity:1}
#sops-chat .m .lvl{background:rgba(128,128,128,.22);border-radius:4px;padding:0 4px;font-size:10.5px}
#sops-chat .m .role{font-size:11px}
#sops-chat .m .anon .nick{color:#8a7bd8}
#sops-chat .m .body{white-space:pre-wrap;word-break:break-word}
#sops-chat .m.deleted .body{opacity:.5;font-style:italic}
#sops-chat .m .edited{opacity:.5;font-size:10.5px;margin-left:4px}
#sops-chat .m .reply-q{border-left:3px solid rgba(128,128,128,.4);padding:1px 6px;margin-bottom:2px;font-size:12px;opacity:.75;cursor:pointer}
#sops-chat .m .acts{position:absolute;top:-8px;right:0;display:none;gap:2px;background:var(--chat-bg,#fff);
  border:1px solid rgba(128,128,128,.3);border-radius:6px;padding:2px}
#sops-chat .m:hover .acts{display:flex}
#sops-chat .m .acts button{background:none;border:none;color:inherit;cursor:pointer;font-size:13px;padding:2px 4px;opacity:.8}
#sops-chat .m .acts button:hover{opacity:1}
#sops-chat .m .body a{color:#2f6fed}
#sops-chat .m .mention{color:#2f6fed;font-weight:600}

#sops-chat .composer{border-top:1px solid rgba(128,128,128,.25);padding:8px 10px;display:flex;flex-direction:column;gap:6px}
#sops-chat .composer .replybar{font-size:12px;opacity:.8;display:flex;gap:6px;align-items:center}
#sops-chat .composer .replybar button{background:none;border:none;cursor:pointer;color:inherit;opacity:.7}
#sops-chat .composer .row{display:flex;gap:6px;align-items:flex-end}
#sops-chat .composer textarea{flex:1;resize:none;max-height:120px;min-height:36px;padding:7px 9px;border-radius:8px;
  border:1px solid rgba(128,128,128,.4);background:transparent;color:inherit;font:inherit;font-size:13.5px}
#sops-chat .composer .send{background:#2f6fed;border:none;color:#fff;border-radius:8px;padding:0 14px;height:36px;cursor:pointer;font-size:14px}
#sops-chat .composer .send:disabled{opacity:.5;cursor:default}
#sops-chat .composer .opts{display:flex;align-items:center;gap:10px;font-size:12px;opacity:.85}
#sops-chat .composer .opts label{display:flex;align-items:center;gap:4px;cursor:pointer}
#sops-chat .notice{padding:8px 12px;font-size:12.5px;opacity:.8;text-align:center}
#sops-chat .modbar{padding:6px 12px;border-bottom:1px solid rgba(128,128,128,.25);font-size:12px;display:flex;gap:8px;flex-wrap:wrap}
#sops-chat .modbar button{font-size:12px;cursor:pointer;background:rgba(128,128,128,.15);border:none;border-radius:5px;padding:3px 7px;color:inherit}
@media (max-width:480px){#sops-chat{width:100vw}}

/* ===== модалки / тосты / инлайн-правка ===== */
#sops-chat-ov{position:fixed;inset:0;z-index:9100;background:rgba(0,0,0,.42);
  display:flex;align-items:center;justify-content:center;padding:16px}
#sops-chat-ov .dlg{background:var(--chat-bg,#fff);color:var(--chat-fg,#1a1a1a);border-radius:12px;
  width:340px;max-width:100%;box-shadow:0 12px 40px rgba(0,0,0,.35);overflow:hidden;
  font:14px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
html[data-theme="dark"] #sops-chat-ov .dlg,body.dark #sops-chat-ov .dlg{--chat-bg:#26272b;--chat-fg:#e6e6e6}
#sops-chat-ov .dlg h4{margin:0;padding:14px 16px 8px;font-size:15px;font-weight:650}
#sops-chat-ov .dlg .cnt{padding:0 16px 12px}
#sops-chat-ov .dlg .cnt p{margin:0 0 8px;opacity:.85}
#sops-chat-ov .dlg textarea,#sops-chat-ov .dlg input[type=text],#sops-chat-ov .dlg input[type=number]{
  width:100%;box-sizing:border-box;padding:8px 10px;border-radius:8px;border:1px solid rgba(128,128,128,.4);
  background:transparent;color:inherit;font:inherit;resize:vertical;min-height:38px}
#sops-chat-ov .dlg .acts{display:flex;gap:8px;padding:10px 14px 14px;justify-content:flex-end;flex-wrap:wrap}
#sops-chat-ov .dlg .acts button{border:none;border-radius:8px;padding:8px 14px;cursor:pointer;font:inherit;font-size:13.5px;
  background:rgba(128,128,128,.16);color:inherit}
#sops-chat-ov .dlg .acts button.primary{background:#2f6fed;color:#fff}
#sops-chat-ov .dlg .acts button.danger{background:#e23b3b;color:#fff}
#sops-chat-ov .dlg .sheet{display:flex;flex-direction:column;gap:6px;padding:4px 14px 14px}
#sops-chat-ov .dlg .sheet button{text-align:left;border:none;border-radius:8px;padding:10px 12px;cursor:pointer;
  font:inherit;font-size:13.5px;background:rgba(128,128,128,.12);color:inherit}
#sops-chat-ov .dlg .sheet button:hover{background:rgba(128,128,128,.22)}
#sops-chat-ov .dlg .sheet button.danger{color:#e23b3b}

#sops-chat-toasts{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:9200;
  display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none}
#sops-chat-toasts .toast{background:#333;color:#fff;padding:9px 15px;border-radius:20px;font-size:13px;
  box-shadow:0 4px 16px rgba(0,0,0,.3);opacity:0;transform:translateY(8px);transition:opacity .18s,transform .18s;max-width:80vw}
#sops-chat-toasts .toast.show{opacity:1;transform:none}
#sops-chat-toasts .toast.err{background:#c0392b}
#sops-chat-toasts .toast.ok{background:#1e7e46}

#sops-chat .m .edit-box{display:flex;flex-direction:column;gap:6px;margin-top:3px}
#sops-chat .m .edit-box textarea{resize:none;min-height:52px;padding:7px 9px;border-radius:8px;
  border:1px solid rgba(128,128,128,.4);background:transparent;color:inherit;font:inherit;font-size:13.5px}
#sops-chat .m .edit-box .eb-acts{display:flex;gap:6px;justify-content:flex-end}
#sops-chat .m .edit-box button{border:none;border-radius:7px;padding:5px 12px;cursor:pointer;font:inherit;font-size:12.5px;background:rgba(128,128,128,.18);color:inherit}
#sops-chat .m .edit-box button.primary{background:#2f6fed;color:#fff}
