/* 消息工作区：一条光谱连起会话与聊天；所有样式限定在 ch- 命名空间内。 */
.ch-wrap { padding-top: 24px; }
.ch-title { display: flex; align-items: baseline; gap: 18px; margin: 0 4px 20px; }
.ch-title h1 { margin: 0; font-size: 30px; font-weight: 400; letter-spacing: .18em; }
.ch-title p { margin: 0; color: var(--ink-3); font-size: 13px; letter-spacing: .08em; }
.ch-workspace {
	position: relative; display: grid; grid-template-columns: minmax(264px, 320px) minmax(0, 1fr);
	height: min(800px, calc(100vh - 240px)); height: min(800px, calc(100dvh - 240px)); min-height: 520px;
	overflow: hidden; isolation: isolate;
}
.ch-workspace::before { content: ""; position: absolute; inset: 0 20px auto; height: 2px; background: var(--spectrum); z-index: 2; }
.ch-sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: color-mix(in srgb, var(--glass) 65%, transparent); border-right: 1px solid var(--line); }
.ch-sidebar-head { min-height: 76px; padding: 18px 20px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ch-sidebar-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .14em; }
.ch-refresh { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--glass-line); border-radius: 50%; color: var(--ink-3); background: var(--glass); }
.ch-refresh svg { width: 17px; height: 17px; }
.ch-refresh:hover { color: var(--primary); background: var(--glass-strong); }
.ch-conversations { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 10px 18px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ch-conversation { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 16px 12px; border-radius: 15px; border: 1px solid transparent; transition: background .16s ease, border-color .16s ease; }
.ch-conversation + .ch-conversation { margin-top: 4px; }
.ch-conversation:hover { background: var(--glass); }
.ch-conversation--active { background: var(--glass-strong); border-color: var(--glass-line); box-shadow: var(--shadow); }
.ch-conversation--service { margin-bottom: 14px; background: color-mix(in srgb, var(--primary) 4%, var(--glass)); }
.ch-conversation--service.ch-conversation--active { background: var(--glass-strong); }
.ch-avatar { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 15px; background: color-mix(in srgb, var(--primary) 9%, var(--glass-strong)); color: var(--primary); }
.ch-avatar > img, .ch-avatar > .ph { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; font-size: 18px; font-family: var(--sans); }
.ch-avatar--service { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--glass-strong)); }
.ch-avatar--service svg { width: 25px; height: 25px; }
.ch-conversation-avatar { position: relative; flex: 0 0 auto; }
.ch-dot { position: absolute; bottom: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--faint); border: 2px solid var(--glass-strong); }
.ch-dot--online { background: var(--online); }
.ch-conversation-copy { flex: 1; min-width: 0; }
.ch-conversation-top, .ch-conversation-bottom { display: flex; gap: 8px; justify-content: space-between; align-items: center; min-width: 0; }
.ch-conversation-top { margin-bottom: 5px; }
.ch-conversation-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.ch-conversation-top time { flex: 0 0 auto; font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ch-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-3); }
.ch-unread { flex: 0 0 auto; display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; font: 600 10px/1 var(--sans); color: var(--glass-strong); background: var(--primary); border-radius: 999px; font-variant-numeric: tabular-nums; }
.ch-official { display: inline-block; padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--primary); font-size: 10px; font-weight: 500; vertical-align: 1px; white-space: nowrap; }
.ch-pin { color: var(--ink-3); font-size: 10px; }
.ch-order-tag { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 2px 6px; font-size: 10px; color: var(--online); background: color-mix(in srgb, var(--online) 7%, transparent); border-radius: 5px; white-space: nowrap; }
.ch-list-note { padding: 14px 12px; font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.ch-list-empty { padding: 40px 10px; text-align: center; color: var(--ink-3); font-size: 13px; }
.ch-list-empty p { margin: 0 0 12px; }
.ch-sidebar-foot { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 15px 22px; font-size: 12px; color: var(--ink-3); }
.ch-sidebar-foot a { display: flex; justify-content: space-between; gap: 12px; }
.ch-sidebar-foot a:hover { color: var(--primary); }
.ch-right { min-width: 0; min-height: 0; }
.ch-panel { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.ch-idle { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px 24px; text-align: center; }
.ch-idle-icon { display: grid; place-items: center; width: 78px; height: 78px; border-radius: 26px; background: color-mix(in srgb, var(--primary) 6%, var(--glass)); color: var(--primary); border: 1px solid var(--glass-line); box-shadow: var(--shadow); }
.ch-idle-icon svg { width: 34px; height: 34px; }
.ch-idle h2 { margin: 24px 0 8px; font-size: 24px; font-weight: 400; letter-spacing: .12em; }
.ch-idle p { margin: 0 0 24px; font-size: 13px; line-height: 1.9; color: var(--ink-3); }
.ch-idle > .linkish { margin-top: 16px; font-size: 12px; }
.ch-chat-head { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 18px; min-height: 84px; padding: 18px 26px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--glass-strong) 60%, transparent); }
.ch-person { display: flex; align-items: center; gap: 13px; flex: 1; min-width: 0; }
.ch-person-avatar { flex: 0 0 auto; }
.ch-person-copy { min-width: 0; }
.ch-person-copy h2 { margin: 0; font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-person-copy p { margin: 2px 0 0; color: var(--ink-3); font-size: 11px; overflow-wrap: anywhere; }
.ch-person-copy .ch-online { color: var(--online); }
.ch-back { display: none; }
.ch-header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ch-header-button { height: 34px; padding: 0 13px; font-size: 12px; }
.ch-menu { position: relative; }
.ch-menu summary { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; list-style: none; cursor: pointer; color: var(--ink-2); font-size: 22px; line-height: 1; }
.ch-menu summary::-webkit-details-marker { display: none; }
.ch-menu[open] summary { color: var(--primary); background: var(--glass-strong); }
.ch-menu-items { position: absolute; top: calc(100% + 8px); right: 0; width: 172px; z-index: 5; padding: 6px; border: 1px solid var(--glass-line); border-radius: 14px; background: var(--glass-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.ch-menu-items button { display: block; width: 100%; padding: 10px 12px; border-radius: 9px; text-align: left; font-size: 12px; }
.ch-menu-items button:hover { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.ch-menu-items button:disabled { opacity: .55; cursor: default; }
.ch-context { min-height: 47px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 12px 26px; font-size: 11px; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.ch-context-order { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; flex: 1; }
.ch-context-order strong { font-size: 12px; font-weight: 500; color: var(--ink-2); overflow-wrap: anywhere; }
.ch-context-order > span:last-child { font-variant-numeric: tabular-nums; }
.ch-context-actions { display: flex; gap: 14px; flex: 0 0 auto; }
.ch-notice { display: flex; flex: 0 0 auto; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 26px; font-size: 12px; color: var(--gold); background: color-mix(in srgb, var(--gold) 5%, transparent); overflow-wrap: anywhere; }
.ch-notice[hidden] { display: none; }
.ch-notice button { flex-shrink: 0; }
.ch-history { position: relative; flex: 1; min-height: 90px; }
.ch-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ch-messages { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; padding: 18px 28px 24px; }
.ch-history-note { margin: 0 0 12px; text-align: center; font-size: 10px; color: var(--ink-3); }
.ch-time { padding: 9px 0 16px; text-align: center; color: var(--ink-3); font: 11px/1.4 var(--sans); font-variant-numeric: tabular-nums; }
.ch-message { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.ch-message:last-child { margin-bottom: 0; }
.ch-message--mine { flex-direction: row-reverse; }
.ch-message > .ch-avatar { width: 32px; height: 32px; border-radius: 11px; }
.ch-message > .ch-avatar > .ph { font-size: 13px; }
.ch-message > .ch-avatar--service svg { width: 20px; height: 20px; }
.ch-avatar--self .ch-self-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.ch-avatar--self > span { font-size: 13px; }
.ch-message-main { display: flex; flex-direction: column; align-items: flex-start; max-width: min(74%, 620px); min-width: 0; }
.ch-message--mine .ch-message-main { align-items: flex-end; }
.ch-bubble { min-width: 30px; max-width: 100%; padding: 11px 16px; border-radius: 3px 16px 16px; color: var(--ink); background: var(--glass-strong); border: 1px solid var(--glass-line); white-space: pre-wrap; overflow-wrap: anywhere; font: 17px/1.65 var(--kai); }
.ch-message--mine .ch-bubble { border-radius: 16px 3px 16px 16px; background: color-mix(in srgb, var(--primary) 9%, var(--glass-strong)); border-color: color-mix(in srgb, var(--primary) 17%, var(--glass-line)); }
.ch-send-state { font-size: 11px; color: var(--ink-3); padding: 5px 2px 0; overflow-wrap: anywhere; }
.ch-send-state--failed { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: var(--gold); }
.ch-retry-actions { display: flex; gap: 12px; }
.ch-retry-actions button { min-height: 26px; }
.ch-message-empty { margin: auto 0; }
.ch-welcome { display: flex; gap: 13px; align-items: flex-start; padding: 22px 0; }
.ch-welcome > div { border: 1px solid var(--glass-line); background: var(--glass); border-radius: 3px 18px 18px; padding: 16px 20px; }
.ch-welcome b { font-size: 14px; font-weight: 500; }
.ch-welcome p { font: 13px/1.9 var(--sans); color: var(--ink-3); margin: 6px 0 0; }
.ch-new { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); padding: 8px 17px; border: 1px solid var(--glass-line); border-radius: 999px; background: var(--glass-strong); color: var(--primary); box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; }
.ch-new[hidden] { display: none; }
.ch-composer { flex: 0 0 auto; padding: 13px 26px 16px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--glass-strong) 70%, transparent); }
.ch-input-label { display: block; color: var(--ink-3); font-size: 11px; margin-bottom: 5px; }
.ch-text { display: block; width: 100%; height: 76px; min-height: 58px; max-height: 180px; resize: vertical; border: 1px solid transparent; border-radius: 10px; background: transparent; padding: 6px 8px; color: var(--ink); font: 15px/1.6 var(--sans); }
.ch-text::placeholder { color: var(--ink-3); font-size: 13px; }
.ch-text:focus { background: var(--glass); border-color: var(--line); outline: none; }
.ch-text:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }
.ch-text:disabled { opacity: .65; cursor: default; }
.ch-compose-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.ch-compose-bottom > div { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; }
.ch-key-tip { color: var(--ink-3); font-size: 10px; }
.ch-count { color: var(--ink-3); font-size: 10px; font-variant-numeric: tabular-nums; }
.ch-count--error { color: var(--gold); }
.ch-send { height: 36px; padding: 0 19px; gap: 8px; justify-content: center; flex: 0 0 auto; font-size: 13px; letter-spacing: .1em; }
.ch-send svg { width: 15px; height: 15px; }
.ch-send:disabled { opacity: .5; cursor: not-allowed; }
.ch-editing { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 11px; color: var(--primary); padding-bottom: 5px; }
.ch-editing[hidden] { display: none; }
.ch-guest { padding: 64px 24px; margin-top: 22px; text-align: center; }
.ch-guest > .ch-idle-icon { margin: 0 auto; }
.ch-guest h1 { font-size: 25px; font-weight: 400; letter-spacing: .1em; margin: 25px 0 10px; }
.ch-guest p { max-width: 33em; margin: 0 auto 24px; color: var(--ink-3); line-height: 1.9; }
.ch-guest-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.ch-order-contact { font-size: 13px; }
.ch-safety-copy { color: var(--ink-3); font-size: 13px; overflow-wrap: anywhere; }
.ch-safety-field { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
.ch-safety-field select { color: var(--ink); }
.ch-safety-error { margin-left: 0; }
.ch-safety button:disabled { cursor: not-allowed; opacity: .55; }
@media (min-width: 1700px) {
	.ch-workspace { grid-template-columns: 350px minmax(0, 1fr); }
	.ch-messages { padding-right: 42px; padding-left: 42px; }
}
@media (max-width: 1050px) and (min-width: 761px) {
	.ch-workspace { grid-template-columns: 280px minmax(0, 1fr); }
	.ch-chat-head { padding: 16px 18px; gap: 10px; }
	.ch-context, .ch-composer, .ch-notice { padding-left: 18px; padding-right: 18px; }
	.ch-messages { padding-left: 18px; padding-right: 18px; }
	.ch-header-button { padding: 0 10px; }
}
@media (max-width: 760px) {
	.ch-wrap { padding-top: 18px; }
	.ch-title { margin: 0 2px 14px; gap: 12px; }
	.ch-title h1 { font-size: 23px; }
	.ch-title p { font-size: 11px; }
	.ch-workspace { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 215px); height: calc(100dvh - 215px); min-height: 490px; border-radius: 18px; }
	.ch-sidebar { border-right: 0; }
	.ch-right { display: none; }
	.ch-workspace--open .ch-sidebar { display: none; }
	.ch-workspace--open .ch-right { display: block; }
	.ch-sidebar-head { min-height: 64px; padding: 14px 18px; }
	.ch-conversation { padding: 15px 12px; }
	.ch-conversation-top time { font-size: 11px; }
	.ch-preview { font-size: 13px; }
	.ch-person { gap: 9px; }
	.ch-person-copy h2 { font-size: 16px; }
	.ch-person-copy p { font-size: 10px; }
	.ch-person > .ch-avatar, .ch-person-avatar > .ch-avatar { width: 38px; height: 38px; border-radius: 13px; }
	.ch-back { display: grid; place-items: center; width: 28px; height: 40px; flex: 0 0 auto; color: var(--ink-2); }
	.ch-back svg { width: 20px; height: 20px; }
	.ch-chat-head { min-height: 76px; padding: 12px; gap: 8px; flex-wrap: wrap; }
	.ch-header-actions { gap: 5px; }
	.ch-header-button { font-size: 11px; height: 32px; padding: 0 11px; }
	.ch-menu summary { width: 32px; height: 32px; }
	.ch-context { padding: 10px 16px; gap: 6px 10px; }
	.ch-context-actions { gap: 12px; }
	.ch-notice { padding: 8px 16px; font-size: 11px; }
	.ch-messages { padding: 12px 14px 20px; }
	.ch-message-main { max-width: 78%; }
	.ch-message { gap: 7px; }
	.ch-message > .ch-avatar { width: 28px; height: 28px; border-radius: 9px; }
	.ch-bubble { padding: 9px 12px; font-size: 16px; }
	.ch-time { font-size: 10px; }
	.ch-composer { padding: 10px 14px 13px; }
	.ch-text { height: 64px; }
	.ch-compose-bottom > div { flex-direction: column; gap: 2px; }
	.ch-key-tip { font-size: 9px; }
	.ch-count { font-size: 10px; }
	.ch-welcome > div { padding: 13px 15px; }
	.ch-welcome { gap: 10px; }
	.ch-welcome p { font-size: 12px; }
	.ch-guest { padding: 40px 18px; }
	.ch-guest h1 { font-size: 22px; }
	.ch-safety-field { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (max-width: 470px) {
	.ch-person { flex-basis: 100%; }
	.ch-header-actions { margin-left: 37px; }
	.ch-chat-head > .ch-official { margin-left: 37px; }
	.ch-context-order > span:last-child { flex-basis: 100%; }
	.ch-context-actions { margin-left: auto; }
	.ch-title p { letter-spacing: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.ch-conversation { transition: none; }
}
