/* Capability-gated chat surface; loading CSS never enables an IM capability. */
.soul-chat{--chat-visual-height:100dvh;--chat-visual-offset:0px;--chat-top-gap:0px;--chat-bottom-gap:0px;box-sizing:border-box;display:grid;grid-template-columns:minmax(210px,30%) minmax(0,1fr);height:100%;min-height:0;max-height:calc(var(--chat-visual-height) - var(--chat-top-gap) - var(--chat-bottom-gap));width:100%;min-width:0;overflow:hidden;border:1px solid #e5e8ed;border-radius:5px;background:#fff;color:#303133;font:14px/1.5 "Microsoft YaHei","PingFang SC","Segoe UI",sans-serif}
.soul-chat *{box-sizing:border-box;min-width:0}.soul-chat button,.soul-chat textarea{font:inherit}.soul-chat button{cursor:pointer}.soul-chat button:disabled{cursor:not-allowed;opacity:.55}.soul-chat button:focus-visible,.soul-chat textarea:focus-visible,.chat-message-scroll:focus-visible{outline:2px solid #409eff;outline-offset:-2px}.soul-chat h2,.soul-chat h3,.soul-chat p{margin:0}.soul-chat ul,.soul-chat ol{list-style:none;margin:0;padding:0}.soul-chat .chat-button{border:1px solid #dcdfe6;border-radius:4px;background:#fff;color:#606266;padding:5px 10px;flex-shrink:0;font-size:12px;line-height:1.5}.soul-chat .chat-button:hover:not(:disabled){border-color:#a0cfff;color:#409eff;background:#ecf5ff}.soul-chat .chat-send{color:#fff;background:#409eff;border-color:#409eff;padding:6px 18px}.soul-chat .chat-send:hover:not(:disabled){background:#337ecc;color:#fff}
.chat-list-pane{display:flex;flex-direction:column;border-right:1px solid #e5e8ed;min-height:0;overflow:hidden}.chat-list-header,.chat-detail-header{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:58px;padding:10px 12px;border-bottom:1px solid #ebeef5;background:#fff;flex-shrink:0}.chat-list-header h2{font-size:15px;font-weight:600}.chat-list-header>div{overflow:hidden}.chat-list-header small{display:block;color:#909399;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-conversations{overflow:auto;min-height:0;flex:1}.chat-conversation{display:flex;align-items:center;gap:9px;width:100%;border:0;border-bottom:1px solid #f0f2f5;padding:12px;text-align:left;background:#fff;color:#303133}.chat-conversation.selected{background:#ecf5ff}.chat-conversation:hover{background:#f5f7fa}.chat-avatar{width:36px;height:36px;flex-shrink:0;border-radius:50%;object-fit:cover;background:#edf2f8}.chat-avatar-empty{display:flex;align-items:center;justify-content:center;font-size:13px;color:#7a8ba1}.chat-summary{flex:1;overflow:hidden}.chat-summary strong,.chat-summary small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-summary strong{font-size:13px;font-weight:500}.chat-summary small{font-size:11px;color:#909399;margin-top:4px}.chat-row-meta{align-self:stretch;display:flex;flex-direction:column;align-items:flex-end;justify-content:space-between;gap:6px;color:#a8abb2;font-size:10px}.chat-row-meta time{white-space:nowrap}.chat-unread{background:#f56c6c;border-radius:10px;color:#fff;min-width:17px;text-align:center;padding:0 4px;font-size:10px}.soul-chat .chat-more{display:block;margin:9px auto}
.chat-detail-pane{display:flex;flex-direction:column;min-height:0;overflow:hidden;background:#f7f8fa}.chat-detail-header h3{font-size:14px;font-weight:500;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.soul-chat .chat-back{display:none}.chat-message-scroll{overflow:auto;overscroll-behavior:contain;flex:1;min-height:0;padding:14px 12px;scroll-padding-block:12px}.chat-messages{display:flex;flex-direction:column;gap:14px}.chat-message{display:flex;align-items:flex-start;flex-direction:column;max-width:86%;font-size:13px}.chat-message-out{align-self:flex-end;align-items:flex-end}.chat-bubble{padding:9px 12px;border:1px solid #ebeef5;border-radius:6px;background:#fff;max-width:100%;overflow:hidden}.chat-message-out .chat-bubble{background:#ecf5ff;border-color:#d9ecff}.chat-text{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.chat-bubble small{color:#909399;font-size:10px}.chat-image{display:block;max-width:100%;width:auto;max-height:240px;height:auto;object-fit:contain;border-radius:3px}.chat-message-meta{display:flex;flex-wrap:wrap;gap:3px 8px;color:#a8abb2;font-size:10px;margin-top:4px;overflow-wrap:anywhere}.chat-note{font-size:12px;color:#909399;line-height:1.7;padding:16px 12px;overflow-wrap:anywhere}.chat-note[role=alert]{color:#c45656}.chat-message-scroll>.chat-note{text-align:center}.chat-bubble .chat-note{padding:0}.chat-send-status{flex-shrink:0;background:#fff;max-height:85px;overflow:auto}.chat-send-status .chat-note{font-size:11px;padding:7px 12px;color:#b88230;border-top:1px solid #faecd8;background:#fdf6ec}.chat-composer{flex-shrink:0;padding:10px 12px max(10px,env(safe-area-inset-bottom));border-top:1px solid #ebeef5;background:#fff}.chat-input-label{display:block;font-size:11px;color:#909399}.chat-input-label textarea{display:block;resize:none;width:100%;min-height:62px;max-height:120px;border:1px solid #dcdfe6;border-radius:4px;background:#fff;color:#303133;padding:7px 9px;line-height:1.5;font-size:14px;margin-top:5px}.chat-input-label textarea:disabled{background:#f5f7fa;color:#a8abb2}.chat-compose-bottom{display:flex;align-items:center;gap:9px;margin-top:8px}.chat-compose-hint{color:#a8abb2;font-size:10px;flex:1}.chat-count{font-size:10px;color:#a8abb2;white-space:nowrap}.chat-composer>.chat-note{padding:5px 0 0;font-size:11px}
@media(max-width:600px){.soul-chat{grid-template-columns:minmax(0,1fr);border-radius:0;border-left:0;border-right:0}.soul-chat[data-chat-pane=list] .chat-detail-pane{display:none}.soul-chat[data-chat-pane=conversation] .chat-list-pane{display:none}.chat-list-pane{border:0}.soul-chat .chat-back{display:block}.chat-detail-header{min-height:50px;padding:8px 10px}.chat-detail-header h3{font-size:13px}.chat-message-scroll{padding:12px 10px}.chat-message{max-width:90%}.chat-input-label textarea{font-size:16px;min-height:56px;max-height:100px}.chat-composer{padding:8px 10px max(8px,env(safe-area-inset-bottom))}.chat-compose-hint{font-size:9px}.chat-compose-bottom{gap:7px}.soul-chat.chat-keyboard-open .chat-compose-hint br{display:none}.soul-chat.chat-keyboard-open .chat-input-label{font-size:0}.soul-chat.chat-keyboard-open .chat-input-label textarea{margin-top:0;min-height:46px}.soul-chat.chat-keyboard-open .chat-detail-header{min-height:43px}.soul-chat.chat-keyboard-open .chat-send-status{max-height:55px}}
@media(max-width:350px){.chat-detail-header{gap:6px}.soul-chat .chat-button{font-size:11px;padding:5px 8px}.chat-row-meta{font-size:9px}.chat-conversation{padding:11px 10px;gap:8px}.chat-avatar{height:32px;width:32px}.chat-compose-hint{font-size:8px}.chat-count{font-size:9px}.soul-chat .chat-send{padding:6px 12px}.chat-bubble{padding:8px 10px}}
.soul-chat{grid-template-rows:auto minmax(0,1fr)}.chat-toolbar{grid-column:1/-1;grid-row:1;display:flex;align-items:center;justify-content:space-between;gap:9px;border-bottom:1px solid #ebeef5;background:#fff;padding:8px 11px;min-height:46px}.chat-toolbar>p{color:#909399;font-size:11px;overflow-wrap:anywhere}.chat-list-pane,.chat-detail-pane{grid-row:2}.chat-toolbar .chat-button{color:#409eff;border-color:#a0cfff}.workspace-frame.chat-active{width:min(980px,calc(100vw - 56px))}.workspace-main.chat-active{display:flex;flex-direction:column;overflow:hidden}.workspace-main.chat-active>.workspace-page-title{flex-shrink:0}.workspace-main.chat-active>#route-content.chat-route{padding:0;flex:1;min-height:0;overflow:hidden}.chat-route #chat-host{height:100%;min-height:0;min-width:0}.chat-route .soul-chat{height:100%;max-height:100%;border:0;border-radius:0}
@media(max-width:600px){.workspace-frame.chat-active{width:100%}.chat-toolbar{padding:6px 10px;gap:7px;min-height:44px}.chat-toolbar>p{font-size:10px}.chat-toolbar .chat-button{padding:5px 8px;font-size:11px}.soul-chat.chat-keyboard-open .chat-toolbar{min-height:36px}.soul-chat.chat-keyboard-open .chat-toolbar>p{font-size:9px}}
.chat-list-actions{display:flex;align-items:center;gap:5px;flex-shrink:0}.chat-list-header .chat-list-actions .chat-button{font-size:11px;padding:5px 7px}.chat-peer-create{flex-shrink:0;overflow:auto;max-height:62%;padding:12px;border-bottom:1px solid #e5e8ed;background:#f8fafc;min-height:0}.chat-peer-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}.chat-peer-heading h3{font-size:13px;font-weight:500}.chat-peer-create form>label{display:block;font-size:11px;color:#606266;margin:0 0 10px}.chat-peer-create [data-chat-peer-id]{display:block;width:100%;font:inherit;font-size:14px;background:#fff;border:1px solid #dcdfe6;border-radius:4px;padding:7px 8px;margin-top:5px;color:#303133;min-height:34px}.chat-peer-create .chat-peer-confirm{display:flex;flex-direction:row;align-items:flex-start;gap:7px;font-size:11px;line-height:1.7}.chat-peer-confirm input{width:14px;height:14px;flex-shrink:0;padding:0;margin:3px 0 0;appearance:auto;accent-color:#409eff}.chat-peer-create .chat-note{padding:4px 0 10px;font-size:11px}.chat-peer-create dl{margin:10px 0;font-size:11px;line-height:1.8}.chat-peer-create dl>div{display:grid;grid-template-columns:62px minmax(0,1fr);gap:8px}.chat-peer-create dt{color:#909399}.chat-peer-create dd{margin:0;overflow-wrap:anywhere}.chat-peer-result{font-size:11px;line-height:1.7;color:#606266}.chat-peer-create [type=submit],.chat-peer-create [data-chat-action=open-created-peer]{color:#409eff;border-color:#a0cfff}
@media(max-width:600px){.chat-peer-create{padding:11px 12px}.chat-peer-create [data-chat-peer-id]{font-size:16px;min-height:36px}.chat-list-header .chat-list-actions .chat-button{font-size:11px}.chat-peer-create form>label{font-size:12px}.chat-peer-create .chat-peer-confirm{font-size:11px}}
/* Inbound pictures only: no upload/voice control, original validated URL only. */
.chat-images{display:flex;flex-direction:column;align-items:flex-start;gap:8px;max-width:260px;min-width:0}.chat-image-card{margin:0;max-width:100%;min-width:0}.soul-chat .chat-image-open{display:block;position:relative;max-width:100%;min-width:80px;min-height:48px;padding:0;border:0;border-radius:4px;background:#f0f2f5;color:#909399;overflow:hidden;text-align:center}.chat-image-open .chat-image{max-width:100%;max-height:240px;width:auto;height:auto;object-fit:contain;border-radius:3px}.chat-image-loading,.chat-image-fallback{display:none;font-size:11px;line-height:1.7;padding:15px 12px;overflow-wrap:anywhere}.chat-image-card[data-image-state=loading] .chat-image-loading{display:block}.chat-image-card[data-image-state=error] .chat-image-fallback{display:block}.chat-image-card[data-image-state=error] .chat-image{display:none}.chat-image-card figcaption{font-size:10px;color:#909399;line-height:1.5;margin-top:3px}.chat-image-preview{width:min(900px,calc(100vw - 32px));max-width:calc(100vw - 24px);max-height:calc(var(--visual-height,100dvh) - 32px);padding:0;border:1px solid #ebeef5;border-radius:5px;background:#fff;color:#303133;overflow:auto}.chat-image-preview::backdrop{background:#0009}.chat-image-preview-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 15px;border-bottom:1px solid #ebeef5}.chat-image-preview-header h2{font-size:14px;margin:0}.chat-image-preview .chat-button{font-family:inherit;font-size:12px;line-height:1.5;border:1px solid #dcdfe6;border-radius:4px;background:#fff;color:#606266;padding:5px 12px;cursor:pointer}.chat-image-preview-body{padding:14px;text-align:center;min-width:0}.chat-image-preview-body>img{display:block;max-width:100%;max-height:calc(var(--visual-height,100dvh) - 125px);width:auto;height:auto;object-fit:contain;margin:auto}.chat-image-preview-body[data-image-state=loading]>.chat-image-loading{display:block}.chat-image-preview-body[data-image-state=error]>.chat-image-fallback{display:block}.chat-image-preview-body[data-image-state=error]>img{display:none}
@media(max-width:600px){.chat-images{max-width:220px}.chat-image-open .chat-image{max-height:220px}.chat-image-preview{width:calc(100vw - 24px);margin:12px auto}.chat-image-preview-header{padding:10px 12px}.chat-image-preview-body{padding:10px}.chat-image-preview-body>img{max-height:calc(var(--visual-height,100dvh) - 110px)}}
.chat-live-bar{grid-column:1/-1;grid-row:1;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 11px;border-bottom:1px solid #ebeef5;background:#fafcff;min-width:0}.chat-live-summary{min-width:0}.chat-live-summary>strong{font-size:11px;line-height:1.7;font-weight:500;display:flex;align-items:center;gap:5px;overflow-wrap:anywhere}.chat-live-summary>small{display:block;font-size:10px;line-height:1.7;color:#909399;margin-top:2px;overflow-wrap:anywhere}.chat-live-dot{display:inline-block;flex-shrink:0;width:6px;height:6px;border-radius:50%;background:#a8abb2}.chat-live-dot.online{background:#67c23a}.chat-live-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:5px;flex-shrink:0}.chat-live-actions .chat-button{font-size:11px;padding:4px 8px}.chat-live-summary>.chat-live-error{color:#b88230}.soul-chat:has(>.chat-live-bar){grid-template-rows:auto auto minmax(0,1fr)}.soul-chat:has(>.chat-live-bar)>.chat-toolbar{grid-row:2}.soul-chat:has(>.chat-live-bar)>.chat-list-pane,.soul-chat:has(>.chat-live-bar)>.chat-detail-pane{grid-row:3}
@media(max-width:600px){.chat-live-bar{padding:7px 10px;align-items:flex-start;flex-wrap:wrap}.chat-live-summary{flex:1 1 100%}.chat-live-actions{margin-left:auto}.chat-live-summary>strong{font-size:11px}.chat-live-summary>small{font-size:9px}.soul-chat.chat-keyboard-open .chat-live-summary>small{display:none}.soul-chat.chat-keyboard-open .chat-live-bar{flex-wrap:nowrap;align-items:center}.soul-chat.chat-keyboard-open .chat-live-summary{flex:1;min-width:0}.soul-chat.chat-keyboard-open .chat-live-actions .chat-button{font-size:10px;padding:3px 6px}}

/* Explicit local PNG picker; no automatic upload or connection switch. */
.chat-upload{flex-shrink:0;max-height:45%;overflow:auto;border-top:1px solid #ebeef5;padding:7px 12px;background:#fff;min-width:0}.chat-upload-toolbar{display:flex;align-items:center;gap:9px}.chat-upload-toolbar>span,.chat-upload-note{font-size:10px;line-height:1.6;color:#909399}.chat-upload-note{padding-top:5px}.chat-upload-note[role=alert]{color:#c45656}.chat-upload-picker{position:relative;overflow:hidden;display:inline-block;cursor:pointer}.chat-upload-picker input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.chat-upload-picker:has(input:disabled){opacity:.55;cursor:not-allowed}.chat-upload-preview{display:flex;align-items:center;gap:10px;margin:8px 0;min-width:0}.chat-upload-preview>img{display:block;max-width:100px;max-height:90px;object-fit:contain;border:1px solid #ebeef5;border-radius:3px}.chat-upload-preview>figcaption{display:flex;flex-direction:column;align-items:flex-start;gap:6px;min-width:0;overflow-wrap:anywhere;font-size:10px;color:#909399}.chat-upload-send{display:flex;align-items:center;justify-content:space-between;gap:8px}.chat-upload-send>label{display:flex;align-items:center;gap:6px;font-size:11px;color:#606266}.chat-upload-send input{width:14px;height:14px;appearance:auto;accent-color:#409eff;flex-shrink:0}.chat-upload .chat-button{font-size:11px;padding:4px 8px}
@media(max-width:600px){.chat-upload{padding:6px 10px;max-height:42%}.chat-upload-preview>img{max-width:76px;max-height:70px}.chat-upload-send>label{font-size:10px}.chat-upload-toolbar>span{font-size:9px}}

/* Bounded file playback, never a recorder or automatic media download. */
.chat-media-tools{flex:0 1 auto;max-height:38%;min-height:0;overflow:auto;background:#fff}.chat-media-tools .chat-upload{max-height:none;overflow:visible}.chat-audio-message{width:min(245px,64vw);max-width:100%}.chat-audio-message audio{display:block;width:100%;max-width:100%;height:34px}.chat-audio-message>small{display:block;margin-top:4px}.chat-audio-preview{display:flex;flex-direction:column;gap:6px;margin:8px 0;min-width:0}.chat-audio-preview audio{display:block;width:100%;max-width:360px;height:34px}.chat-audio-preview figcaption{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:10px;color:#909399;overflow-wrap:anywhere}.chat-audio-preview figcaption>span{min-width:0;overflow-wrap:anywhere}.chat-audio-upload .chat-upload-toolbar{flex-wrap:wrap;gap:5px 9px}
@media(max-width:600px){.chat-media-tools{max-height:38%}.chat-audio-message{width:min(220px,64vw)}.chat-audio-upload .chat-upload-send{flex-wrap:wrap}.chat-audio-upload .chat-upload-send .chat-send{margin-left:auto}}

/* Verified local system expressions: compact picker on both desktop and phone. */
.system-emoji{display:inline-block!important;width:1.65em!important;height:1.65em!important;object-fit:contain;vertical-align:middle;margin:0 .1em;max-width:none!important}
.chat-emoji-box[hidden]{display:none!important}.chat-emoji-box{border:1px solid var(--border,#e0e7ef);border-radius:12px;padding:10px;background:var(--surface,#fff);margin:0 0 8px;min-width:0}
.chat-emoji-search{display:flex;align-items:center;gap:8px;font-size:12px}.chat-emoji-search input{flex:1;min-width:0;padding:6px 9px;border:1px solid var(--border,#e0e7ef);border-radius:7px}
.chat-emoji-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(38px,1fr));max-height:174px;overflow:auto;gap:3px;margin-top:7px;overscroll-behavior:contain}
.system-emoji-choice{display:flex;align-items:center;justify-content:center;width:100%;height:37px;padding:4px;border:0;border-radius:7px;background:transparent;cursor:pointer}.system-emoji-choice:hover,.system-emoji-choice:focus-visible{background:var(--selected,#e6f5f3);outline:2px solid var(--accent,#21a295)}
.system-emoji-choice .system-emoji{width:27px!important;height:27px!important}.chat-emoji-toggle{white-space:nowrap;font-size:12px}
@media(max-width:640px){.chat-emoji-grid{max-height:140px;grid-template-columns:repeat(auto-fill,minmax(32px,1fr))}.chat-compose-bottom .chat-compose-hint{font-size:10px}.chat-emoji-box{padding:7px}}


/* An explicit per-message READ21 button; no automatic read on open/poll. */
.chat-mark-read{align-self:flex-start;margin-top:5px;font-size:11px;color:#409eff}.chat-read-signal{margin-top:4px;color:#909399;font-size:10px;line-height:1.7;max-width:100%;overflow-wrap:anywhere}
@media(max-width:600px){.chat-mark-read{min-height:40px;padding:8px 10px}.chat-read-signal{font-size:11px}}

/* A live connection replaces the old manual-sync toolbar, not an extra row. */
.soul-chat:has(>.chat-live-bar):not(:has(>.chat-toolbar)){grid-template-rows:auto minmax(0,1fr)}
.soul-chat:has(>.chat-live-bar):not(:has(>.chat-toolbar))>.chat-list-pane,
.soul-chat:has(>.chat-live-bar):not(:has(>.chat-toolbar))>.chat-detail-pane{grid-row:2}
.chat-compose-hint{font-size:11px}.chat-upload-toolbar>span{font-size:11px}
