.chat-contact-list{display:flex;flex-direction:column;gap:5px;margin-top:17px}.chat-contact{display:flex;align-items:center;gap:10px;text-align:left;background:transparent;border:1px solid transparent;border-radius:11px;padding:10px 8px;width:100%;color:var(--ink);min-width:0}.chat-contact:hover{background:var(--ui-surface-accent-f3f6ee,#f3f6ee)}.chat-contact.selected{background:var(--ui-surface-accent-edf3df,#edf3df);border-color:var(--ui-line-accent-d9e5c6,#d9e5c6)}.chat-contact .avatar{width:30px;height:30px;font-size:10px;flex-shrink:0}.chat-contact .avatar svg{width:16px;height:16px}.chat-contact-text{display:block;flex:1;min-width:0}.chat-contact-text strong{font-size:12px;font-weight:600;display:block}.chat-contact-text small{font-size:10px;color:var(--ui-text-7a897b,#7a897b);display:block;margin-top:4px;line-height:1.4}.chat-preview{display:block;font-size:10px;color:var(--ui-text-85917e,#85917e);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:5px}.chat-unread{display:inline-block;background:var(--ui-surface-accent-2d7550,#2d7550);border:2px solid var(--ui-line-accent-e4efda,#e4efda);width:10px;height:10px;border-radius:50%;flex-shrink:0}.chat-unread[hidden]{display:none}.chat-contact-list .chat-contact:first-child{margin-bottom:8px;padding-bottom:12px}.chat-recipient-hint{color:var(--ui-text-accent-6e8467,#6e8467);font-size:10px;padding:0 8px 7px}.chat-heading{min-width:0}.chat-heading h3{overflow-wrap:anywhere}.chat-heading p{line-height:1.4}.chat-header{gap:12px}.chat-picker-button{display:none;white-space:nowrap}.chat-back-team{white-space:nowrap}.chat-loading{padding:35px;text-align:center}.chat-older{text-align:center;margin-bottom:20px}.chat-side .panel-pad{padding:18px 13px}.chat-side .panel-pad>.row{padding:0 8px}.chat-side .chat-contact-list{max-height:calc(100dvh - 320px);overflow-y:auto}.chat-message-status{font-size:10px;color:var(--muted)}@media(max-width:900px){.chat-picker-button{display:inline-flex;align-items:center;gap:6px}.chat-back-team{display:none}.chat-header .avatar{width:30px;height:30px;flex-shrink:0}.chat-header h3{font-size:13px}.chat-header p{font-size:10px}.chat-heading{flex:1}.chat-picker-button svg{width:16px;height:16px}#chat-picker-list{padding-bottom:10px}#chat-picker-list .chat-contact{padding:12px}#chat-picker-list .chat-contact-text strong{font-size:14px}.chat-compose .chat-recipient-hint{padding-left:0}.chat-panel{min-width:0}}@media(max-width:600px){.chat-header{padding:12px;gap:8px}.chat-picker-button{font-size:11px;padding:9px}.chat-heading p{font-size:9px}.chat-recipient-hint{font-size:10px}.chat-panel{height:calc(100dvh - 249px);min-height:360px}.chat-contact-text small{overflow-wrap:anywhere}}

/* A single viewport on phones: only the message history scrolls. */
@media(max-width:600px){
 body.mobile-chat-view{overflow:hidden;overscroll-behavior:none}
 .mobile-chat-view .shell{position:fixed;top:var(--chat-viewport-top,0px);left:0;width:100%;height:var(--chat-viewport-height,100dvh);min-height:0;padding:0 0 calc(70px + env(safe-area-inset-bottom,0px));overflow:hidden}
 .mobile-chat-view .workspace{height:100%;display:flex;flex-direction:column;min-height:0}
 .mobile-chat-view .topbar{height:44px;min-height:44px;padding:0 12px}
 .mobile-chat-view .content{padding:0;margin:0;width:100%;max-width:none;flex:1;min-height:0;display:flex;flex-direction:column}
 .mobile-chat-view .content>.page-head,.mobile-chat-view #birthday-banner{display:none}
 .mobile-chat-view .chat-layout{display:flex;flex:1;min-height:0;gap:0}
 .mobile-chat-view .chat-panel{height:auto;min-height:0;flex:1;border:0;border-radius:0;overflow:hidden}
 .mobile-chat-view .chat-header{padding:10px 12px;flex-shrink:0;background:var(--ui-surface-ffffff,#fff)}
 .mobile-chat-view .chat-header h3{font-size:14px}
 .mobile-chat-view .chat-header p{font-size:10px}
 .mobile-chat-view .chat-picker-button{min-height:44px;padding:10px 12px;font-size:12px}
 .mobile-chat-view .messages{padding:16px 10px;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
 .mobile-chat-view .message{max-width:96%;gap:7px;margin-bottom:16px}
 .mobile-chat-view .message>.avatar{width:26px;height:26px;font-size:10px}
 .mobile-chat-view .bubble{min-width:0;padding:10px 12px}
 .mobile-chat-view .bubble p{font-size:14px;line-height:1.5}
 .mobile-chat-view .bubble .link-btn{font-size:11px;min-height:32px}
 .mobile-chat-view .chat-compose{padding:8px 10px 10px;flex-shrink:0;max-height:45%;overflow-y:auto}
 .mobile-chat-view .chat-compose>.row{gap:7px;align-items:flex-end}
 .mobile-chat-view .chat-compose textarea{font-size:16px;min-height:44px;max-height:100px;line-height:1.4;padding:10px 8px}
 .mobile-chat-view .chat-compose .file-label{width:44px;height:44px;flex-shrink:0}
 .mobile-chat-view .chat-compose button[type=submit]{width:48px;min-width:48px;height:44px;padding:10px;flex-shrink:0}
 .mobile-chat-view .chat-help,.mobile-chat-view .chat-recipient-hint{display:none}
 .mobile-chat-view #chat-files:empty{display:none}
 .mobile-chat-view #chat-files{max-height:85px;overflow-y:auto}
 .mobile-chat-view .sidebar{position:absolute;bottom:0;height:calc(70px + env(safe-area-inset-bottom,0px));padding-bottom:calc(7px + env(safe-area-inset-bottom,0px));border-radius:0}
}

/* Desktop chat uses the workspace from edge to edge. */
@media(min-width:601px){
 body.mobile-chat-view{overflow:hidden}
 .mobile-chat-view .shell{height:100dvh;min-height:0}
 .mobile-chat-view .workspace{height:100%;display:flex;flex-direction:column;min-height:0}
 .mobile-chat-view .topbar{flex-shrink:0}
 .mobile-chat-view .content{padding:0;margin:0;width:100%;max-width:none;flex:1;min-height:0;display:flex;flex-direction:column}
 .mobile-chat-view .content>.page-head,.mobile-chat-view #birthday-banner{display:none}
 .mobile-chat-view .chat-layout{flex:1;min-height:0;gap:0;grid-template-columns:minmax(0,1fr) 260px}
 .mobile-chat-view .chat-panel{height:auto;min-height:0;border:0;border-radius:0;overflow:hidden}
 .mobile-chat-view .chat-side{min-height:0;background:var(--ui-surface-ffffff,#fff);border-left:1px solid var(--line);overflow-y:auto}
 .mobile-chat-view .chat-side>.panel{border:0;border-radius:0}
 .mobile-chat-view .chat-side .callout{margin:12px}
 .mobile-chat-view .chat-contact-list{max-height:none}
 .mobile-chat-view .chat-header{flex-shrink:0}
 .mobile-chat-view .chat-compose{flex-shrink:0;max-height:45%;overflow:auto}
 .mobile-chat-view .messages{padding:24px 30px}
}
@media(min-width:601px) and (max-width:900px){.mobile-chat-view .chat-layout{grid-template-columns:1fr}}
.chat-media-list:empty{display:none}.chat-media-list{display:flex;flex-direction:column;gap:10px;margin-top:9px;max-width:100%}
.bubble{min-width:0}.bubble>p:empty{display:none}
.chat-photo{width:360px;max-width:100%;border-radius:11px;overflow:hidden;background:var(--ui-surface-accent-e5e9e1,#e5e9e1)}
.chat-photo-open{display:block;width:100%;padding:0;aspect-ratio:4/3;background:transparent;position:relative;color:var(--ui-text-accent-61775e,#61775e)}
.chat-photo img{width:100%;height:100%;object-fit:contain;display:block}
.chat-photo img[hidden],.chat-photo-status[hidden]{display:none}
.chat-photo-status{display:flex;align-items:center;justify-content:center;position:absolute;inset:0;padding:20px;font-size:12px}
.chat-audio{width:310px;max-width:100%;padding:8px;border-radius:12px;background:var(--ui-surface-accent-eff3e9,#eff3e9)}
.chat-audio audio{display:block;width:100%;height:42px}.chat-audio audio[hidden],.chat-audio-load[hidden]{display:none}
.chat-audio-load{display:flex;align-items:center;gap:14px;background:transparent;width:100%;padding:8px;color:var(--ui-text-accent-245d47,#245d47);text-align:left;font-size:22px}
.chat-audio-load span{font-size:12px;font-weight:600}.chat-audio-load small{display:block;font-size:10px;font-weight:400;margin-top:5px;color:var(--ui-text-798975,#798975)}
.chat-media-error{font-size:11px;line-height:1.5}.chat-media-error:empty{display:none}
.chat-mic{flex-shrink:0;color:var(--accent-text)}
#chat-files{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.chat-draft-file{position:relative;max-width:100%;margin-top:9px}.chat-draft-photo{padding:0;background:var(--ui-surface-accent-edf1e7,#edf1e7);border-radius:10px;overflow:hidden;display:block}
.chat-draft-photo img{display:block;width:116px;height:82px;object-fit:cover}
.chat-draft-remove{position:absolute;right:-4px;top:-4px;background:var(--ui-surface-ffffff,#fff);color:var(--ui-text-accent-34583e,#34583e);border:1px solid var(--ui-line-accent-ced9c7,#ced9c7);width:24px;height:24px;border-radius:50%;font-size:19px;line-height:20px}
.chat-draft-voice{padding:8px 20px 4px 8px;border-radius:10px;background:var(--ui-surface-accent-f0f4e9,#f0f4e9);max-width:100%}.chat-draft-voice small{display:block;font-size:10px;color:var(--ui-text-accent-6a805e,#6a805e);padding:0 10px 5px}.chat-draft-voice audio{display:block;width:280px;max-width:100%;height:38px}
.chat-voice{display:flex;align-items:center;gap:10px;border-radius:10px;background:var(--ui-surface-fff1ed,#fff1ed);padding:9px 12px;margin-top:9px;color:var(--ui-text-7b463a,#7b463a);font-size:12px}.chat-voice[hidden]{display:none}
.voice-indicator{width:9px;height:9px;border-radius:50%;background:var(--ui-surface-d76350,#d76350);flex-shrink:0}
#chat-gallery{width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;border:0;border-radius:0;background:var(--ui-surface-accent-12211cf5,#12211cf5);color:var(--ui-text-ffffff,white);overflow:hidden}
#chat-gallery[open]{display:flex;flex-direction:column}#chat-gallery::backdrop{background:var(--ui-surface-accent-12211c,#12211c)}
.chat-gallery-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 20px;flex-shrink:0}.chat-gallery-toolbar>span{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-gallery-toolbar button,.chat-gallery-toolbar a,.chat-gallery-bottom button{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:10px;background:var(--ui-surface-ffffff17,#ffffff17);color:var(--ui-text-ffffff,white);font-size:25px;flex-shrink:0}
.chat-gallery-stage{min-height:0;flex:1;overflow:auto;display:flex;align-items:center;justify-content:center;padding:10px;position:relative;touch-action:pan-x pan-y pinch-zoom}
#chat-gallery-image{max-width:100%;max-height:100%;object-fit:contain}#chat-gallery-image:not([src]){display:none}
#chat-gallery.zoomed .chat-gallery-stage{display:block}#chat-gallery.zoomed #chat-gallery-image{max-width:none;max-height:none;width:200%;height:auto}
#chat-gallery-error{font-size:13px;position:absolute;top:45%;padding:25px}#chat-gallery-error:empty{display:none}
.chat-gallery-bottom{display:flex;align-items:center;justify-content:center;gap:20px;padding:10px 15px max(10px,env(safe-area-inset-bottom));flex-shrink:0;font-size:12px}
@media(max-width:600px){
 .mobile-chat-view .chat-mic{width:36px;height:44px}
 .mobile-chat-view .chat-compose>.row{gap:3px}
 .mobile-chat-view .chat-compose .file-label{width:36px}
 .mobile-chat-view .chat-compose textarea{width:0;flex:1;min-width:0}
 .mobile-chat-view #chat-files{max-height:110px;flex-wrap:nowrap;overflow:auto;padding:3px 4px 5px}
 .mobile-chat-view .chat-draft-file{flex-shrink:0}
 .mobile-chat-view .chat-draft-voice audio{width:240px}
 .chat-photo{width:280px}
 .chat-audio{width:255px}
 .chat-gallery-toolbar{padding:8px 10px}.chat-gallery-toolbar .row{gap:5px}
 .chat-gallery-toolbar>span{font-size:11px}
}

#chat-text{flex:1;min-width:0;width:0;min-height:44px;max-height:130px;height:44px;font-size:14px;line-height:22px;padding:10px 8px;box-sizing:border-box;overflow-y:hidden;resize:none}
.chat-panel{position:relative}
.chat-drop-overlay{position:absolute;inset:8px;z-index:5;border:2px dashed var(--ui-line-accent-3c815d,#3c815d);border-radius:12px;background:var(--ui-surface-accent-eff7eaf5,#eff7eaf5);display:flex;align-items:center;justify-content:center;pointer-events:none;color:var(--accent-text);text-align:center;padding:20px}
.chat-drop-overlay>div{display:flex;flex-direction:column;align-items:center;gap:12px}
.chat-drop-overlay svg{width:40px;height:40px}.chat-drop-overlay strong{font-size:20px}.chat-drop-overlay span{font-size:12px;line-height:1.5}
@media(max-width:600px){#chat-text{font-size:16px;line-height:22.4px}}

.chat-receipt{display:inline-flex;align-items:center;gap:3px;vertical-align:middle;margin-left:6px;color:var(--ui-text-87988b,#87988b);cursor:help}
.chat-receipt svg{height:14px;width:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.chat-receipt.is-read{color:var(--ui-text-accent-2a8756,#2a8756)}.chat-receipt small{font-size:9px;font-weight:600}

.chat-text-count{text-align:right;font-size:11px;color:var(--muted);padding:5px 2px 0}.chat-text-count[hidden]{display:none}.chat-text-count.is-error{color:var(--ui-text-ac3526,#ac3526)}
