/* e7 chat presentation, scoped to existing messages surfaces. */
#dmThreadActive { position: relative; }
#dmMessages { overflow-anchor:none; }
#dmMessages .dm-date-sep { text-transform:none;letter-spacing:0; }
#dmMessages .dm-bubble.mine {border-radius:18px;}
#dmMessages .dm-bubble.mine:not(.first-in-group) {border-top-right-radius:4px;}
#dmMessages .dm-bubble.mine:not(.last-in-group) {border-bottom-right-radius:4px;}
#dmMessages .dm-bubble.theirs {border-radius:18px;}
#dmMessages .dm-bubble.theirs:not(.first-in-group) {border-top-left-radius:4px;}
#dmMessages .dm-bubble.theirs:not(.last-in-group) {border-bottom-left-radius:4px;}
#dmMessages .dm-bubble.is-deleted {background:transparent;color:var(--text2,#667085);border:1px solid var(--border,#d1d5db);box-shadow:none;}
#dmMessages .chat-emoji-only {background:transparent!important;box-shadow:none!important;border:0;padding:3px 6px;font-size:var(--chat-emoji-size,48px);line-height:1.15;}
.chat-message-time {font-size:11px;line-height:1.5;color:var(--text3,#6b7280);text-align:center;align-self:center;margin:4px 0;}
.chat-message-time[hidden] {display:none;}
.chat-message-meta {display:flex;align-items:center;justify-content:flex-end;gap:4px;min-height:0;align-self:flex-end;}
.chat-message-meta:empty {display:none;}
.chat-send-state {display:inline-flex;width:13px;height:13px;border-radius:50%;box-sizing:border-box;align-items:center;justify-content:center;color:var(--text3,#6b7280);font-size:9px;line-height:1;margin:3px 1px;flex:none;}
.chat-send-state.is-pending {border:1.5px solid currentColor;}
.chat-send-state.is-sent {background:var(--text3,#6b7280);color:var(--bg,#fff);}
#dmMessages .dm-reply-quote {border:0;background:transparent;padding:4px 0 1px;gap:4px;max-width:100%;}
#dmMessages .dm-reply-quote-name {font-weight:400;color:var(--text3,#6b7280);line-height:1.4;}
.chat-reply-content {display:flex;gap:7px;align-items:center;background:var(--bg3,#edf0f4);border-radius:12px;padding:8px 10px;min-width:0;max-width:100%;}
#dmMessages .dm-reply-quote-body {white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.35;max-width:360px;overflow-wrap:anywhere;}
.chat-reply-photo {width:38px;height:38px;border-radius:7px;object-fit:cover;flex:none;}
#dmMessages .dm-bubble-read,#dmMessages .dm-bubble-read.is-group {background:transparent;border:0;padding:0;box-shadow:none;width:auto;height:18px;gap:2px;overflow:visible;cursor:pointer;}
#dmMessages .chat-seen-face,#dmMessages .dm-bubble-read.is-group .chat-seen-face {display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;overflow:hidden;background:var(--accent-strong,#8b5cf6);color:#fff;font-size:9px;margin:0;border:0;}
#dmMessages .chat-seen-face img,#dmMessages .chat-seen-face span {width:16px;height:16px;border-radius:50%;margin:0;border:0;object-fit:cover;}
.chat-new-message {position:absolute;bottom:84px;left:50%;transform:translateX(-50%);border:1px solid var(--border,#d8dbe2);border-radius:20px;background:var(--bg,#fff);color:var(--accent-strong,#7c3aed);box-shadow:0 3px 14px #0002;padding:9px 15px;z-index:8;cursor:pointer;font:600 13px inherit;white-space:nowrap;}
.chat-new-message[hidden] {display:none;}
.chat-seen-overlay {position:fixed;inset:0;background:rgba(16,13,24,.5);z-index:100000;display:grid;place-items:center;padding:16px;box-sizing:border-box;}
.chat-seen-card {--seen-surface:#25212f;--seen-text:#f7f5fa;--seen-muted:#cbc5d7;--seen-line:#51485f;--seen-avatar:#393340;display:flex;flex-direction:column;box-sizing:border-box;width:min(360px,100%);max-height:calc(100dvh - 32px);overflow:hidden;background:var(--seen-surface);color:var(--seen-text);border:1px solid var(--seen-line);border-radius:16px;box-shadow:0 20px 64px #100d183d;}
body.light .chat-seen-card {--seen-surface:#fff;--seen-text:#252133;--seen-muted:#686174;--seen-line:#e9e5ee;--seen-avatar:#f0edf4;}
.chat-seen-card:focus {outline:none;}
.chat-seen-header {display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;padding:10px 12px 10px 20px;border-bottom:1px solid var(--seen-line);}
.chat-seen-header h3 {margin:0;font-size:18px;font-weight:700;line-height:24px;letter-spacing:-.01em;}
.chat-seen-header .chat-seen-close {position:static;margin:0;color:var(--seen-muted);}
.chat-seen-header .chat-seen-close:hover {color:var(--seen-text);}
.chat-seen-list {padding:8px 20px 12px;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;}
.chat-seen-list:focus-visible {outline:2px solid var(--seen-muted);outline-offset:-4px;}
.chat-seen-person {display:flex;align-items:center;gap:12px;min-width:0;padding:10px 0;}
.chat-seen-avatar {width:40px;height:40px;flex:0 0 40px;border-radius:50%;object-fit:cover;display:inline-flex;align-items:center;justify-content:center;background:var(--seen-avatar);color:var(--seen-muted);font-size:15px;font-weight:600;}
.chat-seen-details {display:flex;flex-direction:column;gap:3px;min-width:0;}
.chat-seen-name {font-size:14px;font-weight:600;line-height:20px;overflow-wrap:anywhere;}
.chat-seen-details time {color:var(--seen-muted);font-size:12px;line-height:17px;}
.chat-seen-empty {margin:0;padding:24px 20px;color:var(--seen-muted);font-size:14px;line-height:20px;}

@media(prefers-reduced-motion:reduce){#dmMessages .dm-bubble.is-new,#dmMessages .dm-typing-dot {animation:none!important;}}
.chat-own-status {position:relative;width:34px;height:34px;flex:none;border:0;border-radius:50%;padding:0;background:var(--bg3,#eee);color:var(--text,#333);cursor:pointer;}
.chat-own-status[hidden] {display:none;}.chat-own-status>img {width:100%;height:100%;object-fit:cover;border-radius:50%;}
.chat-own-status .chat-status-dot,#messagesPage .dm-conv-avatar .chat-status-dot {position:absolute;right:-1px;bottom:-1px;}
#messagesPage .dm-conv-avatar {position:relative;overflow:visible;}
#messagesPage .dm-conv-avatar>img {border-radius:50%;}
.chat-peer-word {display:block;font-size:10px;font-weight:400;color:var(--text3,#6b7280);}
#dmThreadActive.is-search-history .chat-new-message {display:none;}

.chat-reply-context .chat-reply-preview:has(.chat-reply-photo){display:flex;gap:8px;align-items:center}.chat-reply-context .chat-reply-photo{width:38px;height:38px;border-radius:7px;object-fit:cover;flex:none}

.chat-reply-photo.chat-attachment{display:inline-flex;min-width:38px;min-height:38px;max-width:38px;max-height:38px;overflow:hidden}.chat-reply-photo.chat-attachment img{width:38px;height:38px;min-height:0;object-fit:cover}.chat-reply-photo .chat-attachment-status{font-size:8px;line-height:1.1;padding:2px}
