/* Test 0.5: one stable scroll surface, touch-sized controls and compact messages. */
.chat-layout{height:min(800px,calc(100dvh - 155px));min-height:440px;overflow:hidden;grid-template-columns:285px minmax(0,1fr)}
.chat-thread{display:flex;flex-direction:column;height:100%;min-width:0;overflow:hidden;position:relative}
.chat-list{overflow:auto;min-height:0}.thread-heading{min-height:64px;padding:10px 16px;flex-shrink:0}.thread-heading>div:first-of-type{flex:1;min-width:0}.thread-heading h3{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.thread-heading p{font-size:11px;margin:3px 0}.thread-tools{display:flex;gap:2px;flex-shrink:0}
.chat-icon-button{border:0;background:transparent;color:#68518e;border-radius:50%;width:40px;height:40px;cursor:pointer;display:inline-grid;place-items:center;font-size:18px}.chat-icon-button:hover{background:#ebe4f3}
.messages{flex:1 1 0;min-height:0;height:auto;padding:12px 16px;gap:7px;overflow:auto;overflow-anchor:none;scrollbar-gutter:stable;touch-action:pan-y;background:#f6f4fa}
.message{max-width:100%;width:100%;margin:0;gap:0}.message .bubble{max-width:min(76%,540px);padding:9px 12px 7px;border-radius:15px;box-shadow:0 1px 2px #3025440a;min-width:110px}.message.me .bubble{margin-left:auto;border-bottom-right-radius:5px}.message:not(.me) .bubble{border-bottom-left-radius:5px;background:#fff}.message .bubble>p{font-size:14px;line-height:1.45;margin:5px 0;white-space:pre-wrap}.message .bubble>p:empty{display:none}.sender-button{padding-right:22px}.sender-button .avatar{width:24px;height:24px;min-width:24px;font-size:11px}.sender-button>span{font-size:11px}.member-status{font-size:10px;margin-top:1px}.message-time{font-size:10px;line-height:1.2;display:block;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;margin-top:4px}.sent-check{color:#8064a8}.sent-check.is-read{color:#5a43a1}.message-menu{top:4px;right:3px}.message-menu summary{min-width:24px;min-height:26px;font-size:12px}.message-menu-panel{width:250px;max-width:calc(100vw - 16px);padding:7px}.message-menu-panel>button{font-size:14px;padding:11px 12px;min-height:42px}.reaction-picker{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));max-height:150px;overflow:auto;gap:1px}.reaction-picker button{min-width:34px;min-height:38px;padding:3px;font-size:23px}.reaction{font-size:12px;padding:3px 7px;min-height:28px}.message-reactions:empty{display:none}.forwarded-label{border-left:2px solid #9975ba;padding-left:7px;font-size:11px;color:#78549a;margin:4px 0;overflow-wrap:anywhere}.message.selected .bubble{outline:2px solid #9c7ac2;background:#e4d7f6}.selection-toggle{position:absolute;inset:0;opacity:0}.selection-mode .message{cursor:pointer}.selection-mode .message .bubble{pointer-events:none}.selection-bar{display:flex;gap:8px;align-items:center;padding:8px 12px;background:#efe7fa;border-bottom:1px solid #ddd0eb;font-size:13px}.selection-bar[hidden]{display:none}.selection-bar strong{margin-right:auto}.selection-bar button{font-size:12px;padding:8px;border:0;border-radius:9px;background:#fff;color:#604581;cursor:pointer}
.inline-player{width:290px;max-width:100%;display:grid;gap:0;color:#67508f}.voice-player{grid-template-columns:48px minmax(0,1fr);align-items:center;background:transparent;padding:2px 0;border-radius:0;min-width:180px}.player-stage{position:relative}.voice-player audio{display:none}.play-toggle{display:grid;place-items:center;border:0;min-width:46px;width:46px;min-height:46px;height:46px;border-radius:50%;padding:11px;background:#8061a6;color:white;cursor:pointer;touch-action:manipulation}.play-toggle svg{width:24px;height:24px}.player-timeline{min-width:0;padding-left:9px}.player-timeline input{display:block;box-sizing:border-box;width:100%;height:36px;min-height:36px;margin:0;cursor:pointer;touch-action:pan-y;accent-color:#8061a6;outline-offset:0}.player-meta{display:flex;align-items:center;gap:8px;font-variant-numeric:tabular-nums;min-height:24px}.player-meta [data-player-time]{font-size:11px;margin-right:auto;white-space:nowrap}.player-meta button{padding:3px 6px;min-width:32px;min-height:28px;font-size:11px;border:0;border-radius:9px;background:#e9def4;color:#624583;cursor:pointer}.player-error{grid-column:1/-1;font-size:11px;color:#9c3948;line-height:1.4}.player-error:empty{display:none}.round-player{display:flex;flex-direction:column;width:230px;max-width:100%}.round-player .player-stage{width:100%;aspect-ratio:1}.round-player .video-note{width:100%;height:100%;aspect-ratio:1;object-fit:cover;cursor:pointer}.round-player .play-toggle{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);background:#231c4388;pointer-events:auto}.round-player.is-playing .play-toggle{opacity:0;pointer-events:none}.round-player.is-playing:hover .play-toggle,.round-player:focus-within .play-toggle{opacity:1;pointer-events:auto}.round-progress{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg);pointer-events:none;fill:none;stroke:#b69ad7;stroke-width:2;stroke-dasharray:100;stroke-dashoffset:calc(100 - var(--played,0))}.round-player .player-timeline{width:100%;padding:0 4px}.is-buffering .play-toggle{box-shadow:0 0 0 4px #d2bfef}.chat-attachment:has(.inline-player)>[data-chat-asset]{display:none}.chat-attachment:has(.inline-player){min-width:0}.chat-attachment img{max-height:340px;max-width:100%;object-fit:contain}.chat-attachments{min-width:0}
.chat-compose{flex-shrink:0;display:grid;grid-template-columns:38px minmax(0,1fr) 44px 44px 44px;gap:3px;align-items:end;padding:10px 12px;background:#fff;border-top:1px solid #e9e2f0;max-height:55%;overflow:auto;overscroll-behavior:contain}.chat-compose textarea{grid-column:2;grid-row:1;font-size:16px!important;line-height:1.35;min-height:44px;max-height:120px;padding:11px 12px;border-radius:20px;resize:none;width:100%;box-sizing:border-box;margin:0}.recording-controls{display:contents!important}.recording-controls .composer-tool{width:40px;height:44px;min-width:40px;padding:9px;grid-row:1;margin:0}.recording-controls [data-attach-chat]{grid-column:1}.recording-controls [data-record="voice"]{grid-column:3}.recording-controls [data-record="video_note"]{grid-column:4}.chat-compose .send-message-button{grid-row:1;grid-column:5;width:42px;height:44px;min-width:42px}.recording-controls>[data-stop-record],.recording-controls>[data-discard-record]{grid-row:3;font-size:12px;padding:9px;min-height:40px}.recording-controls>[data-stop-record]{grid-column:1/3}.recording-controls>[data-discard-record]{grid-column:3/6}#record-status{grid-column:1/-1;font-size:11px}#record-status:empty{display:none}#record-preview{grid-column:1/-1;align-items:center;max-height:32dvh;overflow:auto;overscroll-behavior:contain;gap:6px}#record-preview .video-note,#record-preview .round-player{width:180px;height:auto}#record-preview .camera-preview{height:180px}#reply-banner,#edit-message-banner{grid-column:1/-1;grid-row:auto!important;font-size:12px}.chat-compose:has(#reply-banner:not([hidden])) textarea,.chat-compose:has(#edit-message-banner:not([hidden])) textarea,.chat-compose:has(#reply-banner:not([hidden])) .composer-tool,.chat-compose:has(#edit-message-banner:not([hidden])) .composer-tool,.chat-compose:has(#reply-banner:not([hidden])) .send-message-button,.chat-compose:has(#edit-message-banner:not([hidden])) .send-message-button{grid-row:2}#reply-banner{order:-1}.chat-file-field{grid-column:1/-1;grid-row:auto}.chat-local:empty{display:none}.chat-local{font-size:11px;flex-shrink:0;padding:4px 12px}.chat-readonly{padding:15px;text-align:center;color:#8a7c9b;font-size:13px;background:#fff}.jump-bottom{position:absolute;right:16px;bottom:125px;width:40px;height:40px;border:1px solid #e4dbed;background:#fff;color:#70508e;border-radius:50%;box-shadow:0 3px 12px #32234d22;cursor:pointer;font-size:21px;z-index:2}.jump-bottom[hidden]{display:none}.chat-global-badge{background:#9371b6;color:#fff;border-radius:12px;padding:1px 5px;font-size:10px;line-height:16px;min-width:18px}.chat-list-item.muted .unread-badge{background:#b5aabe}.chat-list-item h3{font-size:13px}.chat-list-item p{font-size:11px}.chat-list-heading{display:flex;align-items:center;justify-content:space-between;padding:8px 10px}.chat-notification{position:fixed;right:20px;top:20px;max-width:calc(100vw - 40px);z-index:110;background:#fff;border-radius:16px;box-shadow:0 8px 40px #30254433;display:flex;padding:6px}.chat-notification[hidden]{display:none}.chat-notification button{border:0;background:none;padding:12px;font-size:13px;color:#51406c;cursor:pointer}.chat-action-dialog{border:1px solid #e2d8ee;border-radius:20px;padding:20px;width:440px;max-width:calc(100vw - 24px);max-height:85dvh;overflow:auto;box-sizing:border-box;color:#30284d}.chat-action-dialog::backdrop{background:#21183166}.chat-action-dialog h2{font-size:18px}.chat-action-dialog input,.chat-action-dialog textarea,.chat-action-dialog select{width:100%;padding:10px;font-size:16px;box-sizing:border-box}.chat-action-dialog>button,.chat-dialog-list button{width:100%;display:block;padding:12px;margin-top:6px;border:0;border-radius:10px;text-align:left;color:#594174;background:#f5f0fa;cursor:pointer;font-size:14px}.chat-dialog-list{max-height:45dvh;overflow:auto}.chat-dialog-list small{display:block;font-size:11px;margin-top:5px;color:#9384a3}.chat-empty-hint{font-size:12px;color:#8a7b9a}.chat-selection-toolbar{margin-bottom:8px}
@media(max-width:760px){.chat-open{overflow:hidden;position:fixed;inset:0;width:100%;height:100%;overscroll-behavior:none}.chat-open .shell{height:100%;padding:0;margin:0}.chat-open .topbar,.chat-open .page-heading,.chat-open .page-footer{display:none}.chat-open #main{position:absolute;left:0;right:0;top:var(--chat-vtop,0px);height:var(--chat-vheight,100dvh);padding:0!important;margin:0;max-width:none;overflow:hidden;box-sizing:border-box}.chat-open .mobile-nav{display:none}.chat-open .chat-layout{height:100%;min-height:0;width:100%;margin:0;border:0;border-radius:0;display:flex}.chat-open .chat-layout>.chat-list{display:none}.chat-open .chat-thread{display:flex;width:100%;height:100%;overflow:hidden}.chat-open .messages{min-height:0;flex:1 1 0;padding:10px 9px;gap:7px}.message .bubble{max-width:88%;padding:8px 10px 6px}.message .bubble>p{font-size:14px;line-height:1.42}.chat-open .thread-heading{padding:calc(7px + env(safe-area-inset-top,0px)) 7px 7px;min-height:56px;gap:3px}.thread-heading h3{font-size:13px}.thread-tools{gap:0}.chat-icon-button{width:34px;height:38px}.thread-heading .thread-back{width:28px;min-width:28px}.chat-open .chat-compose{max-height:60%;padding:7px 6px calc(7px + env(safe-area-inset-bottom,0px));gap:1px;grid-template-columns:32px minmax(0,1fr) 36px 36px 38px}.chat-compose .send-message-button{width:38px;min-width:38px}.recording-controls .composer-tool{min-width:32px;width:36px;padding:7px}.recording-controls [data-attach-chat]{width:32px}.round-player{width:210px}.voice-player{width:255px;min-width:165px}.chat-open .chat-members{max-height:30%;overflow:auto;font-size:12px}.chat-open .chat-members>summary{padding:6px 12px}.chat-open .chat-pins{max-height:56px}.chat-open #record-preview{max-height:30dvh}.chat-notification{left:12px;right:12px;top:calc(12px + env(safe-area-inset-top,0px));max-width:none}.jump-bottom{bottom:100px;right:10px}.chat-layout:not(.show-thread){min-height:400px;height:calc(100dvh - 220px);display:block}.chat-layout:not(.show-thread) .chat-list{height:100%}.chat-layout:not(.show-thread) .chat-thread{display:none}.chat-list-item{padding:11px 9px}.player-meta [data-player-time]{font-size:10px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
.chat-compose:has(#edit-message-banner:not([hidden])) .recording-controls{display:none!important}.chat-description{font-size:12px;padding:7px 14px;background:#faf8fc;max-height:72px;overflow:auto;white-space:pre-wrap;flex-shrink:0;overflow-wrap:anywhere}.selection-mode .chat-compose{opacity:.55;pointer-events:none}.search-hit .bubble{outline:2px solid #ab8bcc}.chat-layout,.thread-heading,.messages,.chat-compose{box-sizing:border-box}.chat-compose textarea{font-family:inherit}html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
@media(min-width:761px){.chat-open{overflow:hidden}.chat-open .topbar,.chat-open .page-heading,.chat-open .page-footer{display:none}.chat-open .shell{padding-bottom:0}.chat-open #main{height:100dvh;padding:16px;box-sizing:border-box;max-width:none}.chat-open .chat-layout{height:100%;min-height:0}.chat-open .chat-thread{min-height:0}.chat-open .chat-compose{max-height:60%}}
.chat-action-dialog input[type=checkbox]{width:auto}.chat-compose[hidden]{display:none!important}
.chat-open .chat-thread .messages{min-height:0!important}.chat-open .chat-members{flex-shrink:0}.chat-open .chat-members[open]{max-height:30%;overflow:auto}
/* The composer still scrolls for long drafts, without a native scrollbar bar. */
.chat-compose textarea{scrollbar-width:none}
.chat-compose textarea::-webkit-scrollbar{display:none}
