/* Messaging (shared) */
.chat-list-head { display: flex; gap: 8px; padding: 12px; position: sticky; top: 0; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--border); }
.chat-item { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.on { background: var(--green-50); }
.chat-item.unread b { color: var(--teal-900); font-weight: 800; }
.chat-item.unread .muted { color: var(--text); font-weight: 600; }
.chat-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.chat-group-ic { border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; flex: none; }

.chat-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-title { border: 0; background: none; text-align: left; padding: 0; cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; -webkit-overflow-scrolling: touch; }
.chat-day { text-align: center; margin: 10px 0 6px; }
.chat-day span { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 3px 10px; border-radius: 99px; }
.msg { display: flex; gap: 6px; align-items: flex-end; max-width: 82%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-av { width: 28px; flex: none; }
.msg-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 7px 11px 5px; min-width: 0; box-shadow: var(--shadow-sm); }
.msg.mine .msg-bubble { background: var(--green); border-color: var(--green); color: #fff; border-radius: 16px 16px 4px 16px; }
.msg-name { font-size: 12px; font-weight: 700; color: var(--teal); margin-bottom: 1px; }
.msg-name span { font-weight: 500; color: var(--muted); }
.msg-text { white-space: pre-wrap; word-wrap: break-word; font-size: 15px; line-height: 1.4; }
.msg-time { font-size: 10.5px; color: var(--faint); text-align: right; margin-top: 2px; }
.msg.mine .msg-time { color: rgba(255, 255, 255, .8); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chat-empty .icon { width: 42px; height: 42px; color: var(--teal-100); }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.chat-compose .input { min-height: 44px; max-height: 140px; resize: none; padding: 10px 14px; border-radius: 22px; line-height: 1.35; }
.chat-send { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; flex: none; }

/* dashboard split view */
.chat-split { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 110px); min-height: 480px; overflow: hidden; position: relative; }
.chat-split-list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-split-thread { min-height: 0; }
@media (max-width: 860px) {
  .chat-split { grid-template-columns: minmax(0, 1fr); }
  .chat-split-thread { display: none; }
}

/* group picture */
.chat-group-ic { overflow: hidden; line-height: 1; }
.chat-group-ic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp-edit { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.gp-seg { max-width: 340px; }
.gp-seg button { font-size: 13px; }
.gp-emojis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin-top: 8px; max-width: 320px; }
.gp-emojis button { border: 1.5px solid transparent; background: var(--surface-2); border-radius: 8px; height: 34px; font-size: 18px; cursor: pointer; padding: 0; }
.gp-emojis button.on { border-color: var(--green); background: var(--green-50); }
.gp-edit .swatches { display: flex; flex-wrap: wrap; }
.gp-edit .swatches button { border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--border); cursor: pointer; padding: 0; }
.gp-edit .swatches button.on { box-shadow: 0 0 0 3px var(--green); }
.gp-edit .btn-save { margin-top: 10px; }
