:root {
  --ink: #252321;
  --muted: #8f8a84;
  --muted-dark: #6d6760;
  --paper: #f6f3ef;
  --panel: rgba(255, 253, 249, .86);
  --line: rgba(72, 62, 53, .11);
  --accent: #e87959;
  --accent-dark: #c95b3e;
  --accent-soft: #fbe4da;
  --sage: #86a995;
  --shadow: 0 24px 70px rgba(60, 43, 31, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); background: var(--paper); font-family: 'Noto Sans SC', 'Manrope', sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }

.app-shell { min-height: 100vh; overflow: hidden; }
.auth-view { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; background: radial-gradient(circle at 14% 18%, #f3d8c9 0, transparent 28%), radial-gradient(circle at 88% 78%, #dce9dd 0, transparent 27%), var(--paper); }
.auth-view::before { content: ''; width: 70vw; height: 70vw; max-width: 850px; max-height: 850px; border: 1px solid rgba(98, 70, 55, .08); border-radius: 50%; position: absolute; transform: translate(20%, -10%); }
.auth-decoration { position: absolute; border-radius: 50%; filter: blur(1px); opacity: .7; }
.auth-decoration-one { width: 130px; height: 130px; right: 15%; top: 13%; border: 1px solid rgba(232, 121, 89, .3); }
.auth-decoration-two { width: 10px; height: 10px; left: 15%; bottom: 22%; background: var(--accent); box-shadow: 20px -10px 0 rgba(232, 121, 89, .35), 38px 5px 0 rgba(232, 121, 89, .2); }
.auth-card { width: min(100%, 418px); position: relative; z-index: 1; padding: 42px 42px 35px; background: var(--panel); border: 1px solid rgba(255, 255, 255, .82); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; color: #fff; font-size: 20px; font-weight: 800; background: var(--ink); border-radius: 15px 15px 15px 4px; transform: rotate(-5deg); box-shadow: 7px 7px 0 var(--accent-soft); }
.brand-mark span { transform: rotate(5deg); }
.eyebrow { margin: 24px 0 6px; color: var(--accent-dark); font: 500 10px/1 'DM Mono', monospace; letter-spacing: .16em; text-transform: uppercase; }
.auth-card h1 { margin: 0; font-size: 38px; letter-spacing: -.06em; }
.auth-subtitle { margin: 8px 0 30px; color: var(--muted-dark); font-size: 14px; }
.auth-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 23px; }
.auth-tab { border: 0; padding: 0 0 13px; color: var(--muted); background: none; font-weight: 700; font-size: 14px; position: relative; }
.auth-tab.is-active { color: var(--ink); }
.auth-tab.is-active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--accent); border-radius: 2px; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted-dark); }
input, textarea { color: var(--ink); background: rgba(255,255,255,.7); border: 1px solid var(--line); outline: none; transition: border .2s, box-shadow .2s, background .2s; }
input:focus, textarea:focus { border-color: rgba(232, 121, 89, .8); background: #fff; box-shadow: 0 0 0 4px rgba(232, 121, 89, .12); }
.auth-form input { width: 100%; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.primary-button { border: 0; color: #fff; padding: 12px 18px; background: var(--ink); border-radius: 12px; font-weight: 700; transition: transform .2s, background .2s; }
.primary-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.full-width { width: 100%; margin-top: 7px; }
.button-spinner { display: none; width: 13px; height: 13px; margin-left: 5px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite; }
.is-busy .button-spinner { display: inline-block; }
.is-busy #auth-submit-label { opacity: .65; }
.auth-hint { min-height: 18px; margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.form-error { min-height: 18px; margin: 4px 0 0; color: #bf4f3c; font-size: 12px; text-align: center; }

.chat-view { min-height: 100vh; background: linear-gradient(135deg, #f8f6f2, #f1eeea); }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 4vw; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.45); backdrop-filter: blur(15px); }
.topbar-brand, .topbar-actions, .connection-indicator, .person-card, .composer { display: flex; align-items: center; }
.topbar-brand { gap: 11px; }
.topbar-brand strong { display: block; font-size: 15px; letter-spacing: -.04em; }
.topbar-brand span { display: block; color: var(--muted); font: 9px 'DM Mono', monospace; letter-spacing: .08em; text-transform: uppercase; }
.mini-mark { width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--ink); border-radius: 11px 11px 11px 3px; font-size: 14px; font-weight: 800; }
.topbar-actions { gap: 17px; }
.connection-indicator { gap: 7px; color: var(--muted); font: 10px 'DM Mono', monospace; }
.connection-indicator i, .presence-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #c5beb7; }
.connection-indicator i.is-online, .presence-dot.is-online { background: var(--sage); box-shadow: 0 0 0 4px rgba(134,169,149,.13); }
.avatar-button, .icon-button { padding: 0; border: 0; background: none; }
.avatar { overflow: hidden; display: inline-grid; place-items: center; flex: 0 0 auto; color: #fff; background: #a9988b; font-weight: 700; }
.avatar img, .avatar-image { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar-button .avatar { width: 34px; height: 34px; border: 2px solid #fff; box-shadow: 0 2px 9px rgba(0,0,0,.12); }
.avatar-fallback { background: linear-gradient(135deg, #9c8779, #d58c6d); }
.icon-button { color: var(--muted-dark); }
.icon-button svg, .composer-button svg, .send-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { color: var(--accent-dark); }
.chat-layout { width: min(1260px, 92vw); min-height: calc(100vh - 76px); display: grid; grid-template-columns: 270px minmax(0, 1fr); margin: 0 auto; }
.chat-sidebar { display: flex; flex-direction: column; padding: 48px 24px 28px 0; border-right: 1px solid var(--line); }
.sidebar-label { color: var(--muted); font: 10px 'DM Mono', monospace; letter-spacing: .14em; text-transform: uppercase; }
.person-card { gap: 12px; padding: 19px 15px; margin-top: 15px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.44); }
.avatar-large { width: 42px; height: 42px; border-radius: 14px; font-size: 13px; }
.person-meta { min-width: 0; flex: 1; }
.person-meta strong, .person-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta strong { font-size: 13px; }
.person-meta span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.presence-dot { margin-left: auto; }
.sidebar-note { display: flex; gap: 10px; padding: 23px 11px; color: var(--muted-dark); }
.sidebar-note span { color: var(--accent); font-size: 22px; line-height: 1; }
.sidebar-note p { margin: 0; font-size: 11px; line-height: 1.7; }
.sidebar-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; margin-top: auto; color: var(--muted); border-top: 1px solid var(--line); font: 10px 'DM Mono', monospace; }
.conversation { min-width: 0; display: flex; flex-direction: column; padding: 44px 0 24px 6vw; }
.conversation-header { display: flex; justify-content: space-between; align-items: end; padding-bottom: 24px; }
.conversation-header .eyebrow { margin: 0 0 7px; }
.conversation-header h2 { margin: 0; font-size: 25px; letter-spacing: -.06em; }
.message-count { color: var(--muted); font: 10px 'DM Mono', monospace; }
.messages { min-height: 280px; flex: 1; display: flex; flex-direction: column; gap: 17px; padding: 14px 5px 25px 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #d5ccc5 transparent; }
.loading-state, .empty-state { display: grid; place-items: center; align-content: center; gap: 11px; flex: 1; min-height: 220px; color: var(--muted); font-size: 12px; text-align: center; }
.loader { width: 20px; height: 20px; border: 2px solid #e3dbd4; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.empty-state .empty-symbol { color: var(--accent); font-size: 27px; }
.empty-state p { margin: 0; line-height: 1.8; }
.message-row { display: flex; gap: 9px; align-items: end; max-width: min(75%, 580px); animation: rise .25s ease both; }
.message-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar { width: 27px; height: 27px; border-radius: 10px; font-size: 9px; }
.message-content { min-width: 0; }
.message-bubble { padding: 11px 14px; color: var(--ink); background: rgba(255,255,255,.88); border: 1px solid rgba(72,62,53,.07); border-radius: 4px 16px 16px 16px; box-shadow: 0 5px 18px rgba(75,56,42,.04); font-size: 14px; line-height: 1.65; word-break: break-word; }
.mine .message-bubble { color: #fff; background: var(--ink); border-radius: 16px 4px 16px 16px; }
.message-time { display: flex; gap: 5px; align-items: center; margin-top: 5px; color: var(--muted); font: 9px 'DM Mono', monospace; }
.mine .message-time { justify-content: end; }
.read-state { color: var(--accent-dark); }
.message-image { display: block; max-width: min(100%, 330px); max-height: 310px; border-radius: 13px; object-fit: cover; cursor: zoom-in; }
.image-bubble { padding: 4px; }
.mine .image-bubble { background: var(--ink); }
/* WhatsApp 风格语音气泡：圆形播放键 + 波形进度 + 时长，不再使用原生 audio 控件 */
.audio-bubble { display: flex; align-items: center; gap: 9px; width: 292px; max-width: 100%; padding: 5px 10px; }
.audio-element { display: none; }
.audio-play { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; color: #54656f; border: 0; border-radius: 50%; background: transparent; }
.audio-play:hover { background: rgba(11, 20, 26, .07); }
.audio-play:focus-visible { outline: 2px solid #25d366; outline-offset: 1px; }
.audio-play svg { width: 22px; height: 22px; fill: currentColor; }
.audio-play .icon-pause { display: none; }
.audio-play.is-playing .icon-play { display: none; }
.audio-play.is-playing .icon-pause { display: block; }
.mine .audio-play { color: #fff; }
.mine .audio-play:hover { background: rgba(255, 255, 255, .22); }
.audio-progress { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; height: 32px; }
.audio-waveform { display: flex; align-items: center; gap: 2px; width: 100%; height: 100%; pointer-events: none; }
.audio-waveform i { flex: 1 1 0; min-width: 2px; max-width: 4px; border-radius: 2px; background: #aebac1; }
.audio-waveform i.is-played { background: #54656f; }
.mine .audio-waveform i { background: rgba(17, 27, 33, .4); }
.mine .audio-waveform i.is-played { background: #111b21; }
.audio-slider { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.audio-slider:focus-visible { outline: 2px solid #25d366; outline-offset: 2px; border-radius: 5px; }
.audio-slider::-webkit-slider-runnable-track { height: 32px; background: transparent; }
.audio-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 10px; height: 10px; margin-top: 11px; border: 2px solid #54656f; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(11, 20, 26, .28); }
.audio-slider::-moz-range-track { height: 32px; background: transparent; }
.audio-slider::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #54656f; border-radius: 50%; background: #fff; }
.mine .audio-slider::-webkit-slider-thumb { border-color: #111b21; }
.mine .audio-slider::-moz-range-thumb { border-color: #111b21; }
.audio-duration { flex: 0 0 auto; min-width: 36px; color: #667781; font: 11px 'DM Mono', monospace; text-align: right; }
.mine .audio-duration { color: rgba(17, 27, 33, .68); }
.recording-bar { display: flex; align-items: center; gap: 11px; min-height: 50px; padding: 8px 12px; margin: 0 0 9px; color: var(--muted-dark); background: var(--accent-soft); border-radius: 13px; font-size: 12px; }
.recording-bar strong { font: 12px 'DM Mono', monospace; }
.recording-bar button:not(.primary-button) { margin-left: auto; color: var(--muted-dark); border: 0; background: none; font-size: 12px; }
.recording-bar .primary-button { padding: 8px 12px; margin-left: 0; }
.recording-pulse { width: 9px; height: 9px; background: var(--accent); border-radius: 50%; animation: pulse 1s ease-in-out infinite; }
.composer { gap: 9px; padding: 9px 10px 9px 13px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.7); box-shadow: 0 8px 30px rgba(75,56,42,.04); }
.composer textarea { min-width: 0; flex: 1; resize: none; max-height: 120px; padding: 8px 4px; border: 0; background: transparent; font-size: 14px; line-height: 1.6; }
.composer textarea:focus { box-shadow: none; background: transparent; }
.composer-button { display: grid; place-items: center; flex: 0 0 auto; width: 31px; height: 31px; color: var(--muted); border: 0; border-radius: 10px; background: transparent; }
.composer-button:hover { color: var(--accent-dark); background: var(--accent-soft); }
.voice-button.is-recording { color: #fff; background: var(--accent); }
.send-button { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; color: #fff; border: 0; border-radius: 12px; background: var(--accent); transition: transform .2s, background .2s; }
.send-button:hover { background: var(--accent-dark); transform: translateX(2px); }
.composer-hint { margin: 9px 2px 0; color: var(--muted); font-size: 10px; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: min(90vw, 340px); padding: 11px 15px; color: #fff; opacity: 0; transform: translateY(10px); pointer-events: none; background: var(--ink); border-radius: 11px; box-shadow: 0 10px 25px rgba(0,0,0,.16); font-size: 12px; transition: opacity .22s, transform .22s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #b64e3b; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.7); } }

@media (max-width: 760px) {
  .auth-view { padding: 17px; }
  .auth-card { padding: 32px 25px 27px; border-radius: 22px; }
  .topbar { height: 66px; padding: 0 18px; }
  .connection-indicator { display: none; }
  .chat-layout { width: 100%; min-height: calc(100vh - 66px); display: block; }
  .chat-sidebar { min-height: 0; display: block; padding: 16px 18px 0; border-right: 0; }
  .sidebar-label, .sidebar-note, .sidebar-bottom { display: none; }
  .person-card { margin: 0; padding: 11px 13px; }
  .conversation { min-height: calc(100vh - 150px); padding: 23px 18px 14px; }
  .conversation-header { padding-bottom: 13px; }
  .conversation-header h2 { font-size: 21px; }
  .messages { min-height: 260px; padding-right: 0; }
  .message-row { max-width: 88%; }
  .composer-hint { text-align: center; }
}

/* 入口页：独立于聊天界面的原创双人活动海报风格 */
.auth-view { display: block; min-height: 100vh; overflow: hidden; background: #ef3c29; }
.auth-view::before { display: none; }
.poster-art { position: absolute; inset: 0; background: url('/assets/entry-poster.png') center/cover no-repeat; }
.poster-wash { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(189, 26, 17, .18), rgba(239, 60, 41, .06) 45%, rgba(255, 203, 66, .2)); mix-blend-mode: multiply; }
.entry-card { position: absolute; z-index: 2; top: 50%; left: 50%; width: min(410px, calc(100vw - 36px)); padding: 28px 30px 24px; transform: translate(-50%, -50%); color: #351919; background: rgba(255, 250, 235, .96); border: 2px solid rgba(255,255,255,.8); border-radius: 28px; box-shadow: 0 24px 55px rgba(122, 20, 12, .24), 7px 7px 0 rgba(255, 211, 71, .76); }
.entry-logo-row { display: flex; align-items: center; gap: 9px; }
.entry-logo { width: 39px; height: 39px; object-fit: contain; border-radius: 12px; box-shadow: 2px 3px 0 rgba(239, 60, 41, .15); }
.entry-logo-name { color: #e53e2d; font-size: 20px; font-weight: 900; letter-spacing: -.09em; }
.deal-badge { display: inline-block; padding: 6px 10px; margin: 22px 0 10px; color: #fff8db; background: #ee4631; border-radius: 999px 999px 999px 3px; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.entry-card h1 { margin: 0; color: #8f221b; font-size: clamp(32px, 6vw, 46px); line-height: 1.07; letter-spacing: -.08em; }
.entry-card h1 em { color: #ed4b2f; font-style: normal; }
.entry-copy { margin: 14px 0 23px; color: #86675e; font-size: 13px; line-height: 1.8; }
.password-label { display: block; margin-bottom: 7px; color: #80534a; font-size: 11px; font-weight: 800; }
.password-wrap { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: #fff; border: 1px solid #f1c6aa; border-radius: 14px; transition: box-shadow .2s, border .2s; }
.password-wrap:focus-within { border-color: #e94e35; box-shadow: 0 0 0 4px rgba(238,70,49,.12); }
.lock-symbol { color: #e94b32; font-size: 22px; transform: rotate(180deg); }
.password-wrap input { min-width: 0; flex: 1; padding: 13px 0; border: 0; background: transparent; box-shadow: none; font-size: 14px; }
.password-wrap input:focus { box-shadow: none; background: transparent; }
.reveal-button { padding: 5px; color: #e64b35; border: 0; background: none; font-size: 11px; font-weight: 800; }
.cut-button { display: flex; justify-content: center; align-items: center; gap: 13px; width: 100%; padding: 14px 18px; margin-top: 13px; color: #fffbea; border: 0; border-radius: 13px 13px 13px 3px; background: linear-gradient(135deg, #ff7134, #df2f2b); box-shadow: 0 7px 0 #ad2721, 0 13px 20px rgba(221, 52, 37, .22); font-size: 15px; font-weight: 900; transition: transform .15s, box-shadow .15s; }
.cut-button:hover { transform: translateY(-2px); box-shadow: 0 9px 0 #ad2721, 0 15px 22px rgba(221, 52, 37, .26); }
.cut-button:active { transform: translateY(4px); box-shadow: 0 3px 0 #ad2721; }
.cut-button b { font-size: 22px; line-height: 1; }
.cut-button .button-spinner { display: none; width: 14px; height: 14px; margin: 0; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.cut-button.is-busy .button-spinner { display: block; }
.entry-footnote { margin: 21px 0 0; color: #ad8d7b; font-size: 10px; text-align: center; }
.entry-footnote span { color: #ec5237; font-weight: 900; }
.entry-card .form-error { min-height: 17px; margin: 10px 0 0; color: #c3392b; font-size: 11px; text-align: center; }
.poster-sticker { position: absolute; z-index: 2; padding: 8px 13px; color: #a62b20; background: #ffd24c; box-shadow: 3px 4px 0 rgba(130, 27, 18, .18); font-size: 11px; font-weight: 700; line-height: 1.35; transform: rotate(-7deg); }
.poster-sticker strong { color: #e83b2c; font-size: 14px; }
.sticker-top { top: 13%; left: 13%; border-radius: 3px 14px 14px 14px; }
.sticker-bottom { right: 12%; bottom: 12%; border-radius: 14px 3px 14px 14px; transform: rotate(6deg); }
.mini-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; }
.identity-chip { display: grid; gap: 3px; padding: 15px 14px; margin-top: 14px; background: rgba(238, 95, 59, .08); border: 1px dashed rgba(219, 101, 73, .35); border-radius: 15px; }
.identity-chip span, .identity-chip small { color: var(--muted); font-size: 10px; }
.identity-chip strong { color: var(--accent-dark); font-size: 15px; }
.chat-sidebar .sidebar-note { padding-top: 18px; }

@media (max-width: 760px) {
  .entry-card { padding: 24px 22px 20px; box-shadow: 0 20px 40px rgba(122,20,12,.24), 5px 5px 0 rgba(255,211,71,.76); }
  .sticker-top { top: 8%; left: 5%; }
  .sticker-bottom { right: 5%; bottom: 7%; }
}

/* WhatsApp 风格聊天空间：固定视口，聊天区域内部滚动 */
html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { touch-action: manipulation; }
.app-shell { width: 100%; height: 100dvh; min-height: 100dvh; overflow: hidden; }
.chat-view { width: 100%; height: 100dvh; min-height: 100dvh; overflow: hidden; background: #efeae2; }
.topbar { height: 68px; padding: 0 28px; color: #fff; background: #075e54; border-bottom: 0; box-shadow: 0 1px 3px rgba(0,0,0,.16); backdrop-filter: none; }
.topbar-brand strong { color: #fff; font-size: 16px; }
.topbar-brand span { color: rgba(255,255,255,.7); }
.mini-logo { background: #fff; }
.topbar-actions { gap: 15px; }
.connection-indicator { color: rgba(255,255,255,.78); }
.connection-indicator i { background: rgba(255,255,255,.45); }
.connection-indicator i.is-online { background: #b9f2bb; box-shadow: 0 0 0 4px rgba(185,242,187,.16); }
.avatar-button .avatar { border-color: rgba(255,255,255,.65); }
.icon-button { color: rgba(255,255,255,.9); }
.icon-button:hover { color: #fff; }
.back-button { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; margin-right: 7px; padding: 0; color: #fff; border: 0; border-radius: 50%; background: transparent; }
.back-button:hover { background: rgba(255,255,255,.13); }
.back-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar:has(.back-button:not(.is-hidden)) .topbar-brand { margin-right: auto; }

.contact-view { width: min(760px, 100%); height: calc(100dvh - 68px); margin: 0 auto; padding: 62px 28px; background: #f7f5f2; }
.contact-heading { margin-bottom: 27px; }
.contact-eyebrow { margin: 0 0 8px; color: #667c76; font: 10px 'DM Mono', monospace; letter-spacing: .14em; }
.contact-heading h1 { margin: 0; color: #111b21; font-size: clamp(27px, 4vw, 36px); letter-spacing: -.06em; }
.contact-heading p:last-child { margin: 9px 0 0; color: #667781; font-size: 13px; }
.contact-card { display: flex; align-items: center; width: 100%; padding: 17px 20px; color: #111b21; text-align: left; border: 1px solid #d9e1df; border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(11,20,26,.06); transition: transform .16s, box-shadow .16s, background .16s; }
.contact-card:hover { background: #f0f2f5; box-shadow: 0 4px 14px rgba(11,20,26,.11); transform: translateY(-1px); }
.avatar-contact { width: 52px; height: 52px; border-radius: 50%; font-size: 14px; }
.contact-card-copy { display: grid; gap: 5px; min-width: 0; flex: 1; margin-left: 15px; }
.contact-card-copy strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.contact-card-copy small { overflow: hidden; color: #667781; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.contact-unread { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px; margin-right: 14px; color: #fff; border-radius: 999px; background: #25d366; font-size: 10px; font-weight: 700; }
.contact-chevron { width: 20px; height: 20px; fill: none; stroke: #8696a0; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.contact-footnote { margin: 27px 0; color: #8696a0; font-size: 11px; text-align: center; }

.chat-layout { width: min(1440px, 100%); height: calc(100dvh - 68px); min-height: 0; grid-template-columns: 330px minmax(0, 1fr); margin: 0 auto; background: #fff; }
.chat-sidebar { min-height: 0; padding: 27px 18px; background: #fff; border-right: 1px solid #d9e1df; }
.sidebar-label { color: #667781; font: 10px 'DM Mono', monospace; letter-spacing: .13em; }
.person-card { margin-top: 14px; padding: 14px 13px; border: 0; border-radius: 3px; background: #f0f2f5; box-shadow: none; }
.person-card .avatar-large { width: 45px; height: 45px; border-radius: 50%; }
.person-meta strong { color: #111b21; font-size: 14px; }
.person-meta span { color: #667781; }
.identity-chip { margin-top: 20px; border: 0; border-radius: 3px; background: #f0f2f5; }
.identity-chip strong { color: #075e54; }
.sidebar-note { color: #667781; }
.sidebar-note span { color: #25d366; }
.conversation { position: relative; height: 100%; min-height: 0; padding: 0 30px 19px; background-color: #efeae2; background-image: radial-gradient(rgba(101, 114, 118, .09) .7px, transparent .7px); background-size: 17px 17px; }
.conversation-header { min-height: 75px; padding: 17px 2px 15px; border-bottom: 1px solid rgba(134,150,160,.2); }
.conversation-header .eyebrow { color: #667781; font-size: 9px; }
.conversation-header h2 { color: #111b21; font-size: 21px; }
.messages { min-height: 0; padding: 22px 10px 24px 2px; gap: 9px; scrollbar-color: #bac3c5 transparent; }
.loading-state, .empty-state { min-height: 160px; color: #667781; }
.empty-state .empty-symbol { color: #25d366; }
.message-row { max-width: min(72%, 640px); gap: 7px; }
.message-avatar { width: 24px; height: 24px; border-radius: 50%; font-size: 8px; }
.message-bubble { position: relative; padding: 8px 10px; color: #111b21; background: #fff; border: 0; border-radius: 0 7px 7px 7px; box-shadow: 0 1px 1px rgba(11,20,26,.13); font-size: 14px; line-height: 1.55; }
.mine .message-bubble { color: #111b21; background: #d9fdd3; border-radius: 7px 0 7px 7px; }
.message-time { margin-top: 3px; color: #8696a0; font-size: 9px; }
.read-state { color: #53bdeb; }
.message-actions { position: absolute; z-index: 4; top: 7px; opacity: 0; transition: opacity .15s; }
.theirs .message-actions { right: -28px; }
.mine .message-actions { left: -28px; }
.message-row:hover .message-actions, .message-actions:focus-within { opacity: 1; }
.message-menu-button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; color: #667781; border: 0; border-radius: 50%; background: rgba(255,255,255,.75); font-size: 17px; line-height: 1; }
.message-menu-button:hover { color: #111b21; background: #fff; }
.message-menu { position: absolute; top: 26px; right: 0; display: none; width: 168px; padding: 5px 0; border-radius: 3px; background: #fff; box-shadow: 0 3px 12px rgba(11,20,26,.2); }
.message-menu.is-open { display: grid; }
.message-menu button { padding: 10px 13px; color: #111b21; text-align: left; border: 0; background: #fff; font-size: 12px; }
.message-menu button:hover { background: #f0f2f5; }
.message-menu button.danger-action { color: #c0392b; }
.image-bubble { padding: 3px; }
.recording-bar { border-radius: 3px; background: #d9fdd3; }
.emoji-panel { display: grid; grid-template-columns: repeat(9, minmax(28px, 1fr)); gap: 2px; max-height: 180px; margin: 0 0 8px; padding: 9px; overflow-y: auto; border: 1px solid #d9e1df; border-radius: 6px; background: #fff; box-shadow: 0 3px 14px rgba(11,20,26,.14); }
.emoji-choice { display: grid; place-items: center; width: 100%; min-height: 30px; padding: 0; border: 0; border-radius: 4px; background: transparent; font-size: 21px; }
.emoji-choice:hover { background: #f0f2f5; }
.emoji-button-face { color: currentColor; font-size: 21px; line-height: 1; }
.composer { gap: 5px; padding: 7px 9px; border: 1px solid #d9e1df; border-radius: 5px; background: #f0f2f5; box-shadow: 0 1px 1px rgba(11,20,26,.08); }
.composer textarea { padding: 7px 5px; color: #111b21; }
.composer-button { width: 34px; height: 34px; color: #54656f; border-radius: 50%; }
.composer-button:hover { color: #075e54; background: #dfe5e7; }
.voice-button.is-recording { color: #fff; background: #25d366; }
.send-button { width: 35px; height: 35px; border-radius: 50%; background: #128c7e; }
.send-button:hover { background: #075e54; transform: none; }
.composer-hint { color: #667781; }

@media (hover: none) {
  .message-actions { opacity: 1; }
}

@media (max-width: 760px) {
  .topbar { height: 60px; padding: 0 13px; }
  .chat-view, .app-shell { height: 100dvh; min-height: 100dvh; }
  .contact-view { height: calc(100dvh - 60px); padding: 42px 17px; }
  .chat-layout { height: calc(100dvh - 60px); min-height: 0; display: block; }
  .chat-sidebar { display: none; }
  .conversation { height: 100%; min-height: 0; padding: 0 10px max(11px, env(safe-area-inset-bottom)); }
  .conversation-header { min-height: 66px; padding: 13px 6px 11px; }
  .conversation-header .eyebrow { margin-bottom: 4px; }
  .conversation-header h2 { font-size: 19px; }
  .messages { padding: 16px 5px 18px; }
  .message-row { max-width: 87%; }
  .theirs .message-actions { right: -26px; }
  .mine .message-actions { left: -26px; }
  .emoji-panel { grid-template-columns: repeat(8, 1fr); max-height: 168px; }
  .composer-hint { display: none; }
  .topbar-brand span { display: none; }
}

/* Final WhatsApp Web layout pass */
.chat-view.is-contact-home > .topbar { display: none; }
.chat-view.is-contact-home .contact-view { display: grid; }
.contact-view { display: grid; grid-template-columns: minmax(320px, 390px) minmax(0, 1fr); width: 100%; height: 100dvh; min-height: 0; padding: 0; margin: 0; background: #f0f2f5; }
.contacts-pane { min-width: 0; background: #fff; border-right: 1px solid #d1d7db; }
.contacts-pane-header { display: flex; align-items: center; justify-content: space-between; height: 59px; padding: 0 20px; color: #e9edef; background: #202c33; }
.contacts-pane-header strong { font-size: 18px; font-weight: 600; letter-spacing: -.04em; }
.contacts-pane-header div { display: flex; align-items: center; gap: 7px; color: #aebac1; font-size: 11px; }
.contact-header-dot { width: 7px; height: 7px; border-radius: 50%; background: #25d366; box-shadow: 0 0 0 3px rgba(37,211,102,.16); }
.contact-settings-button { width: 27px; height: 27px; padding: 0; color: #aebac1; border: 0; border-radius: 50%; background: transparent; font-size: 16px; line-height: 1; }
.contact-settings-button:hover { color: #fff; background: rgba(255,255,255,.1); }
.contact-heading { padding: 27px 20px 15px; margin: 0; }
.contact-eyebrow { margin: 0 0 7px; color: #667781; font: 10px 'DM Mono', monospace; letter-spacing: .1em; }
.contact-heading h1 { margin: 0; color: #111b21; font-size: 27px; letter-spacing: -.06em; }
.contact-heading p:last-child { margin: 6px 0 0; color: #667781; font-size: 12px; }
.contact-search { display: flex; align-items: center; gap: 9px; height: 42px; margin: 0 12px 8px; padding: 0 14px; color: #54656f; border-radius: 8px; background: #f0f2f5; }
.contact-search span { font-size: 22px; line-height: 1; transform: rotate(-20deg); }
.contact-search input { width: 100%; padding: 0; color: #3b4a54; border: 0; background: transparent; box-shadow: none; font-size: 13px; }
.contact-search input:focus { box-shadow: none; background: transparent; }
.contact-card { width: calc(100% - 12px); min-height: 72px; margin: 0 6px; padding: 12px 14px; border: 0; border-top: 1px solid #f0f2f5; border-radius: 0; background: #fff; box-shadow: none; }
.contact-card:hover { background: #f0f2f5; box-shadow: none; transform: none; }
.avatar-contact { width: 49px; height: 49px; border-radius: 50%; }
.contact-card-copy { margin-left: 13px; }
.contact-card-copy strong { font-size: 15px; }
.contact-card-copy small { color: #667781; }
.contact-chevron { display: none; }
.contact-footnote { margin: 26px 20px; color: #8696a0; font-size: 10px; text-align: center; }
.contact-empty { display: grid; place-items: center; align-content: center; min-width: 0; color: #667781; text-align: center; border-bottom: 6px solid #25d366; }
.contact-empty-icon { display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 17px; border-radius: 50%; background: #d9e2e5; }
.contact-empty-icon img { width: 54px; height: 54px; object-fit: contain; }
.contact-empty h2 { margin: 0; color: #41525d; font-size: 27px; font-weight: 400; letter-spacing: -.05em; }
.contact-empty p { margin: 9px 0 4px; color: #667781; font-size: 13px; }
.contact-empty small { color: #8696a0; font-size: 10px; }

.topbar { height: 59px; padding: 0 19px; background: #202c33; box-shadow: none; }
.topbar-brand strong { color: #e9edef; }
.topbar-brand span { color: #aebac1; }
.mini-logo { width: 35px; height: 35px; border-radius: 50%; }
.connection-indicator { color: #aebac1; }
.icon-button { color: #aebac1; }
.back-button { color: #aebac1; }
.chat-layout { height: calc(100dvh - 59px); grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); background: #fff; }
.chat-sidebar { padding: 0; background: #fff; border-right: 1px solid #d1d7db; }
.chat-sidebar::before { content: '聊天'; display: block; padding: 27px 20px 13px; color: #111b21; font-size: 23px; font-weight: 600; letter-spacing: -.06em; }
.sidebar-label { display: none; }
.person-card { width: 100%; min-height: 72px; margin: 0; padding: 12px 20px; border: 0; border-top: 1px solid #f0f2f5; border-radius: 0; background: #fff; }
.person-card:hover { background: #f0f2f5; }
.person-meta strong { font-size: 15px; }
.identity-chip, .sidebar-note { display: none; }
.conversation { padding: 0 18px 10px; background-color: #efeae2; background-image: radial-gradient(rgba(101,114,118,.09) .7px, transparent .7px); background-size: 17px 17px; }
.conversation-header { min-height: 59px; align-items: center; padding: 8px 5px; background: #f0f2f5; border-bottom: 1px solid #d1d7db; }
.conversation-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar-conversation { width: 40px; height: 40px; border-radius: 50%; font-size: 11px; }
.conversation-header .eyebrow { display: none; }
.conversation-header h2 { overflow: hidden; color: #111b21; font-size: 16px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title-wrap small { display: block; margin-top: 2px; overflow: hidden; color: #667781; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.message-count { color: #667781; }
.messages { padding: 22px 13px 24px 4px; }
.composer { border-radius: 8px; background: #f0f2f5; }
.composer-hint { display: none; }
.message-row { max-width: min(72%, 640px); }
.message-bubble { padding: 7px 9px; border-radius: 7px; }
.mine .message-bubble { border-radius: 7px; background: #d9fdd3; }
.message-actions { top: 5px; }

@media (max-width: 760px) {
  .chat-view.is-contact-home .topbar { display: none; }
  .contact-view { display: block; height: 100dvh; }
  .contacts-pane { height: 100%; border-right: 0; }
  .contact-empty { display: none; }
  .contacts-pane-header { height: 59px; padding: 0 17px; }
  .contact-heading { padding: 25px 17px 13px; }
  .contact-search { margin-left: 9px; margin-right: 9px; }
  .contact-card { width: 100%; margin: 0; padding-left: 17px; padding-right: 17px; }
  .chat-layout { height: calc(100dvh - 59px); }
  .chat-sidebar { display: none; }
  .conversation { padding: 0 8px max(8px, env(safe-area-inset-bottom)); }
  .conversation-header { padding-left: 3px; padding-right: 3px; }
  .messages { padding: 16px 4px 18px; }
}

/* 设置、会话级右滑删除与资料编辑 */
.settings-view { position: absolute; z-index: 30; inset: 0; overflow: auto; background: #f0f2f5; }
.settings-header { display: flex; align-items: center; gap: 16px; height: 59px; padding: 0 20px; color: #e9edef; background: #202c33; }
.settings-header strong { font-size: 18px; font-weight: 500; }
.settings-back { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: #e9edef; border: 0; border-radius: 50%; background: transparent; }
.settings-back:hover { background: rgba(255,255,255,.1); }
.settings-back svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.settings-body { width: min(640px, 100%); margin: 0 auto; padding: 42px 24px 70px; }
.settings-avatar-button { position: relative; display: block; width: 104px; height: 104px; padding: 0; margin: 0 auto 34px; border: 0; border-radius: 50%; background: transparent; }
.avatar-settings { width: 104px; height: 104px; border-radius: 50%; font-size: 26px; }
.avatar-edit-mark { position: absolute; right: 0; bottom: 0; padding: 5px 7px; color: #fff; border-radius: 8px; background: #00a884; font-size: 10px; }
.settings-card { padding: 19px 20px; margin-bottom: 12px; background: #fff; border-radius: 3px; box-shadow: 0 1px 2px rgba(11,20,26,.08); }
.settings-card label { display: block; margin-bottom: 10px; color: #00a884; font-size: 12px; }
.settings-name-row { display: flex; align-items: center; gap: 12px; }
.settings-name-row input { min-width: 0; flex: 1; padding: 9px 0; color: #111b21; border: 0; border-bottom: 1px solid #d1d7db; border-radius: 0; background: transparent; box-shadow: none; font-size: 15px; }
.settings-name-row input:focus { border-bottom-color: #00a884; box-shadow: none; background: transparent; }
.settings-name-row button, .settings-action { padding: 8px 13px; color: #fff; border: 0; border-radius: 4px; background: #00a884; font-size: 12px; }
.settings-name-row button:hover, .settings-action:hover { background: #008f72; }
.settings-error { min-height: 16px; margin: 8px 0 0; color: #d93025; font-size: 11px; }
.settings-option-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-option-card div { display: grid; gap: 5px; }
.settings-option-card strong { color: #111b21; font-size: 14px; font-weight: 500; }
.settings-option-card small { color: #667781; font-size: 11px; }
.settings-action:disabled { color: #8696a0; background: #e9edef; cursor: not-allowed; }
.settings-note { color: #8696a0; font-size: 11px; line-height: 1.7; text-align: center; }
.contact-swipe-wrap { position: relative; overflow: hidden; background: #fff; }
.contact-swipe-wrap .contact-card { position: relative; z-index: 1; transition: transform .18s ease; }
.contact-swipe-wrap.is-swiped .contact-card { transform: translateX(116px); }
.conversation-delete-action { position: absolute; z-index: 0; top: 0; bottom: 0; left: 0; width: 116px; padding: 0; color: #fff; border: 0; background: #ea4335; font-size: 12px; }
.delete-modal { position: absolute; z-index: 40; inset: 0; display: grid; place-items: center; padding: 20px; }
.delete-modal-backdrop { position: absolute; inset: 0; background: rgba(11,20,26,.52); }
.delete-modal-card { position: relative; width: min(360px, 100%); padding: 23px; border-radius: 8px; background: #fff; box-shadow: 0 10px 35px rgba(11,20,26,.28); }
.delete-modal-card h2 { margin: 0; color: #111b21; font-size: 18px; font-weight: 500; }
.delete-modal-card p { margin: 8px 0 18px; color: #667781; font-size: 12px; line-height: 1.6; }
.modal-option, .modal-cancel { width: 100%; padding: 12px 13px; margin-top: 8px; text-align: left; border: 0; border-radius: 4px; background: #f0f2f5; font-size: 13px; }
.modal-option:hover { background: #e1e7e9; }
.modal-option.danger-option { color: #d93025; }
.modal-cancel { color: #00a884; text-align: center; background: transparent; }
#messages .message-actions { display: none !important; }

@media (max-width: 760px) {
  .settings-body { padding: 32px 14px 50px; }
  .settings-avatar-button { margin-bottom: 27px; }
  .contact-swipe-wrap .contact-card { width: 100%; margin: 0; }
  .delete-modal-card { padding: 20px; }
}
