/* Chat: right-column box, bottom-right dock (bar + windows). */
.chat-box { margin-bottom: 18px; }
.chat-box .sec-t { align-items: center; }
.chat-title { display: flex; align-items: center; gap: 5px; }
.chat-title .count { color: var(--muted); font-weight: 400; }
.chat-settings { position: relative; }
.chat-settings > button { display: flex; align-items: center; gap: 4px; padding: 0; font-size: 11px; color: var(--link); background: none; border: 0; }
.chat-settings .bullet { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(#5c8fc5, #3a6aa0); }
.chat-set-pop { position: absolute; top: 17px; right: 0; z-index: 60; width: 170px; padding: 4px 0; background: #fff; border: 1px solid #9fb6cf; border-radius: 2px; box-shadow: 0 3px 8px rgba(0,0,0,.2); }
.chat-set-pop button { display: flex; align-items: center; gap: 7px; width: 100%; padding: 6px 12px; font-size: 11px; text-align: left; color: var(--link); background: none; border: 0; }
.chat-set-pop button:hover { background: var(--soft-blue); }
.chat-set-pop button.on { font-weight: 700; }
.chat-list { background: #fff; border: 1px solid var(--line-2); border-radius: 2px; }
.chat-list .search { position: relative; padding: 6px; border-bottom: 1px solid var(--line); }
.chat-list .search .inp { padding-right: 22px; font-size: 11px; }
.chat-list .search .ico { position: absolute; top: 12px; right: 12px; color: #aaa; }
.chat-list ul { max-height: 420px; padding: 3px 0; overflow-y: auto; }
.chat-list li button { display: flex; align-items: center; gap: 7px; width: 100%; padding: 3px 8px; font-size: 11.5px; text-align: left; color: #333; background: none; border: 0; }
.chat-list li button:hover { color: var(--link); background: var(--soft-blue); }
.chat-list li { position: relative; }
.chat-list li .ctx-arrow { position: absolute; top: 0; right: 4px; bottom: 0; display: none; place-items: center; width: 16px; color: #8aa; cursor: pointer; }
.chat-list li:hover .ctx-arrow { display: grid; }
.chat-list li:hover .unread { margin-right: 16px; }
.chat-list li .ctx-arrow:hover { color: var(--link); }
.chat-ctx { position: fixed; z-index: 70; width: 150px; padding: 4px 0; background: #fff; border: 1px solid #9fb6cf; border-radius: 2px; box-shadow: 0 3px 8px rgba(0,0,0,.2); font-weight: 400; text-shadow: none; }
.chat-ctx button, .chat-ctx a, .chat-list li .chat-ctx button { display: block; gap: 0; width: 100%; padding: 6px 12px; font-size: 11px; text-align: left; color: var(--link); background: none; border: 0; }
.chat-ctx button:hover, .chat-ctx a:hover, .chat-list li .chat-ctx button:hover { background: var(--soft-blue); text-decoration: none; }
.chat-list li .mob { margin-left: auto; color: #999; }
.chat-list li .unread { margin-left: auto; }
.chat-list li.none { padding: 8px; color: var(--muted); font-size: 11px; }
.chat-off { padding: 14px 10px; text-align: center; color: var(--muted); }
.chat-off button { margin-top: 4px; }

.chatdock { position: fixed; bottom: 0; right: 14px; z-index: 50; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 8px; pointer-events: none; }
.chatdock > * { pointer-events: auto; }
.chatbar { position: relative; width: 190px; }
.chatbar > button { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px; font-weight: 700; color: #333; background: linear-gradient(#fafafa, #e6e6e6); border: 1px solid #b9b9b9; border-bottom: 0; border-radius: 4px 4px 0 0; box-shadow: 0 0 6px rgba(0,0,0,.15); }
.chatbar > button .count { color: var(--muted); font-weight: 400; }
.chatbar-pop { position: absolute; right: 0; bottom: 100%; width: 220px; background: #fff; border: 1px solid #b9b9b9; border-radius: 4px 4px 0 0; box-shadow: 0 -2px 10px rgba(0,0,0,.18); }
.chatbar-pop .chat-box { margin: 0; padding: 8px 8px 0; }
.chatbar-pop .chat-list { border: 0; }
.chatbar-pop .chat-list ul { max-height: 320px; }

.cw { position: relative; display: flex; flex-direction: column; width: 236px; background: #fff; border: 1px solid #8eaacb; border-bottom: 0; border-radius: 4px 4px 0 0; box-shadow: 0 0 8px rgba(0,0,0,.22); }
.cw-h { display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 8px; font-weight: 700; color: #fff; text-shadow: 0 -1px rgba(0,0,0,.25); cursor: pointer; user-select: none; background: linear-gradient(var(--hdr-top), var(--hdr-bottom)); border-radius: 3px 3px 0 0; }
.cw-h .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-h button { display: grid; place-items: center; padding: 2px; color: #dbe7f4; background: none; border: 0; }
.cw-h button:hover { color: #fff; }
.cw-h.alert { animation: cw-blink 1.2s steps(2, jump-none) infinite; }
@keyframes cw-blink { to { background: linear-gradient(#f7b955, #e9921d); } }
.cw-body { height: 250px; padding: 6px 8px; overflow-y: auto; font-size: 12px; background: #fff; }
.cw-intro { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 4px 0 8px; font-size: 11px; color: #777; border-bottom: 1px solid #eee; }
.cw-intro img { width: 32px; height: 32px; }
.cw-line { margin: 3px 0; line-height: 1.35; overflow-wrap: anywhere; }
.cw-line b { color: var(--link); }
.cw-line.me b { color: #777; }
.cw-line .t { margin-left: 4px; font-size: 10px; color: #bbb; }
.cw-line.pending { opacity: .55; }
.cw-typing { padding: 2px 0; font-size: 11px; font-style: italic; color: #999; }
.cw-typing.err { color: #c0392b; font-style: normal; }
.cw-in { padding: 5px; border-top: 1px solid #ddd; }
.cw-in input { width: 100%; padding: 5px 6px; font-size: 12px; border: 1px solid #ccc; border-radius: 2px; outline: none; }
.cw-in input:focus { border-color: #7aa6d6; }

@media (min-width: 1001px) { .chatbar.home { display: none; } }
@media (max-width: 1000px) { .col-r > .chat-box { display: none; } }
@media (max-width: 760px) {
  .chatdock { left: 8px; right: 8px; flex-direction: column-reverse; align-items: flex-end; gap: 0; }
  .cw { width: 100%; border-radius: 6px 6px 0 0; box-shadow: 0 -4px 18px rgba(0,0,0,.25); }
  .cw:not(:last-child) { display: none; }
  .cw-body { height: min(300px, 45dvh); }
  .cw-in input, .chat-list .search .inp { font-size: 16px; }
  .chatbar { width: 140px; }
  .chatbar-pop { width: min(300px, 100vw - 16px); }
}
