/* The open conversation is its own screen with one composer. */
.shell.messenger-shell.conversation-open{padding-bottom:0;height:var(--chat-viewport-height,100dvh)}
.shell.messenger-shell.conversation-open>.dock{display:none!important}
.msg-screen .message-list{background:#f5f4ed url('/assets/ksilo-nature.svg') repeat;background-size:310px;padding:12px 14px 18px;overflow-anchor:none}
.msg-screen .message-bubble{background:#fffefa;border:1px solid #e4e8dc;box-shadow:0 1px 2px #34513a0b;border-radius:17px 17px 17px 4px;padding:9px 11px 5px}
.msg-screen .outgoing .message-bubble{background:#dcefd6;border-color:#d0e4c9;border-radius:17px 17px 4px 17px}
.msg-screen .message-wrap,.msg-screen .incoming .message-wrap,.msg-screen .outgoing .message-wrap{max-width:88%;min-width:0}
.msg-screen .message-bubble p{font-size:16px;line-height:1.4}
.msg-screen .message-time{font-size:10px;margin-top:4px;gap:6px}
.msg-screen .message-time [data-msg=message-menu]{width:18px;height:20px;opacity:.45}
.msg-screen .message-time .icon{width:13px;height:13px}
.msg-screen .message-bubble blockquote{background:#bbd9b44d;border-left:3px solid #6a9a75;padding:7px 9px;border-radius:7px;font-size:12px;margin:0 0 8px}
.msg-day{display:flex;justify-content:center;margin:11px 0 15px}.msg-day span{padding:4px 14px;border-radius:14px;background:#fffffff0;color:#58715e;box-shadow:0 1px 3px #34513a0b;font-size:11px;font-weight:600}
.msg-forwarded{display:block;font-size:11px;font-style:italic;color:#719274;margin-bottom:5px}
.msg-call-card{display:flex;align-items:center;gap:12px;text-align:left;min-width:195px;padding:7px 1px;color:#274a38;background:none}
.msg-call-card>.icon{width:42px;height:42px;padding:10px;border-radius:50%;background:#f3faed;flex:none}
.msg-call-card strong{font-size:16px;display:block}.msg-call-card small{font-size:13px;display:block;margin-top:4px;color:#708773}
.msg-audio{display:flex;align-items:center;gap:8px;min-width:190px;width:260px;max-width:100%;padding:8px 0 1px;color:#49734f}
.msg-audio>button{display:grid;place-items:center;flex:none;width:33px;height:38px;padding:4px}.msg-audio>button .icon{width:24px;height:24px;fill:#5b856233;stroke:#49734f}
.msg-audio>a{display:grid;place-items:center;flex:none;color:#668469;width:20px}.msg-audio>a>.icon{width:17px;height:17px}
.msg-audio-track{position:relative;flex:1;min-width:0;padding-bottom:18px}.msg-audio-bars{display:flex;align-items:center;gap:2px;height:33px;overflow:hidden}
.msg-audio-bars i,.msg-live-wave i{display:block;flex:1;min-width:1px;max-width:4px;background:#9ab799;border-radius:3px}
.msg-audio-track:after{content:'';position:absolute;top:0;left:var(--progress,0%);height:33px;width:2px;background:#3f724d;pointer-events:none}
.msg-audio-track input{position:absolute;inset:0 0 18px;width:100%;height:33px;margin:0;opacity:0;cursor:pointer;z-index:2;touch-action:pan-y}
.msg-audio-track input:focus-visible{opacity:.2;outline:2px solid #447e62}
.msg-audio-time{position:absolute;left:0;bottom:0;font-size:10px;color:#71876c}
.msg-receipt.read{color:#379cc1}.msg-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:-3px}.msg-reaction{border:1px solid #d8e3cc;background:#fdfef8;border-radius:14px;padding:2px 5px;font-size:15px;display:flex;align-items:center;gap:3px}.msg-reaction small{font-size:10px}.msg-reaction.own{background:#e4f2df;border-color:#aacd9e}
#msg-compose{background:#f5f4ed;border:0;padding:8px 10px max(8px,env(safe-area-inset-bottom));max-width:100%;box-sizing:border-box}
#msg-compose .compose-inline{display:flex;align-items:center;gap:5px;max-width:100%}
#msg-compose .compose-inline>.round{width:32px;min-width:32px;height:40px;padding:5px;background:none;border:0}
#msg-compose .compose-inline>.round .icon{width:24px;height:24px}
#msg-compose .msg-input-wrap{display:flex;align-items:center;flex:1;min-width:0;border:1px solid #d5dfd1;border-radius:23px;background:#fffffc;overflow:hidden}
#msg-compose .msg-input-wrap textarea{display:block;flex:1;min-width:0;width:0;height:39px;min-height:39px;max-height:105px;padding:9px 6px 9px 12px;border:0;border-radius:0;background:transparent;font-size:16px;line-height:21px;outline:none}
#msg-compose .msg-input-wrap>.round{display:grid;place-items:center;width:27px;height:34px;min-width:27px;padding:4px;border:0;background:none}
#msg-compose .msg-input-wrap>.round .icon{width:19px;height:19px}
#msg-compose .compose-inline>[data-msg=voice],#msg-compose .compose-inline>.chat-send,#msg-compose .msg-record-actions>.chat-send{width:39px;min-width:39px;height:39px;border-radius:50%;background:#679a88;color:#fff;border:1px solid #5e8f7c;padding:8px}
#msg-compose .msg-status{margin:0;padding:4px 5px 0;font-size:10px}
#msg-compose .compose-context{margin:0 2px 7px;padding:7px 6px 7px 11px;background:#e7efdf;border-left:3px solid #7aa378;border-radius:6px}
.msg-record-top{display:flex;align-items:center;gap:20px;padding:6px 10px}.msg-record-top time{font-size:20px;min-width:50px;color:#33563a}.msg-live-wave{height:32px;display:flex;align-items:center;justify-content:flex-end;gap:3px;flex:1;min-width:0;overflow:hidden}
.msg-record-actions{display:flex;align-items:center;justify-content:space-between;padding:8px 10px}.msg-record-actions>.round{width:40px;height:40px;border:0}.msg-record-actions [data-msg=voice-pause]{color:#c2424a}.msg-record-actions [data-msg=voice-cancel]{color:#486f50}
.msg-selection-bar{display:flex;align-items:center;justify-content:space-between;padding:10px 16px max(12px,env(safe-area-inset-bottom));background:#f7f8f1;border-top:1px solid #d9e3d2;flex:none}.msg-selection-bar button{width:40px;height:40px;display:grid;place-items:center}.msg-selection-bar strong{font-size:14px;font-weight:500}
.msg-screen .message-selected{background:#cde6bc44;border-radius:12px}.msg-screen .message-selected .message-bubble{outline:2px solid #96bf80;outline-offset:1px}
.msg-select-toggle{display:grid;place-items:center;align-self:center;flex:none;width:26px;height:32px;color:#538c58;font-size:25px;padding:0}
.msg-reaction-picker{display:flex;align-items:center;justify-content:space-between;gap:1px;margin:0 0 12px;background:#f3f7ec;border-radius:28px;padding:4px}
.msg-reaction-picker button{font-size:25px;min-width:0;flex:1;height:43px;padding:3px}
.msg-overlay{backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px);background:#d1d7c344}
.msg-dialog{max-width:450px;background:#fbfcf6;border:1px solid #dbe4d0;border-radius:25px;box-shadow:0 12px 65px #36503530}
.msg-dialog .message-preview{padding:12px 14px;background:#e0f0d6;border:1px solid #cfe5c5;border-radius:15px;max-height:120px;overflow:auto;font-size:14px;margin-bottom:10px}
.msg-dialog .list-button{font-size:15px;min-height:42px;padding:10px 3px}.msg-dialog .list-button>.icon{width:21px;height:21px}
.msg-dialog [data-msg=delete]{color:#a73a46}
@media(max-width:699px){.shell.messenger-shell.conversation-open{position:fixed;top:var(--chat-viewport-top,0px);left:0;right:0;max-width:100%;margin:0;overflow:hidden}.shell.messenger-shell.conversation-open>.header{display:none}.conversation-open .msg-thread-head{padding-top:max(10px,env(safe-area-inset-top));min-height:66px}.msg-screen .thread-header .thread-person strong{font-size:16px}.msg-screen .thread-header .thread-person small{font-size:11px}.msg-dialog{padding:17px;max-height:85dvh}.msg-audio{width:240px}.msg-screen .message-list{padding:8px 10px 14px}}
@media(max-width:360px){#msg-compose{padding-left:6px;padding-right:6px}#msg-compose .compose-inline{gap:2px}.msg-audio{width:200px;min-width:160px}.msg-screen .message-wrap,.msg-screen .incoming .message-wrap,.msg-screen .outgoing .message-wrap{max-width:92%}}
/* Keep both media controls inside the phone, independently of textarea sizing. */
#msg-compose{width:100%;min-width:0;padding-left:8px;padding-right:8px;overflow:hidden}
#msg-compose .compose-inline{display:grid;grid-template-columns:32px minmax(0,1fr) 34px 42px;gap:5px;align-items:center;width:100%;min-width:0}
#msg-compose .compose-inline>[data-msg=attach]{grid-column:1;grid-row:1}
#msg-compose .msg-input-wrap{grid-column:2;grid-row:1;width:100%;min-width:0;box-sizing:border-box}
#msg-compose .msg-input-wrap textarea{flex:1 1 0;min-width:0;width:0;box-sizing:border-box}
#msg-compose .compose-inline>[data-msg=camera]{grid-column:3;grid-row:1;width:34px;min-width:0;max-width:34px}
#msg-compose .compose-inline>[data-msg=voice],#msg-compose .compose-inline>.chat-send{grid-column:4;grid-row:1;width:42px;min-width:0;max-width:42px;height:42px}
#msg-compose .compose-inline>.round{padding:5px;box-sizing:border-box}
#msg-compose .msg-input-wrap>.round{flex:0 0 26px;width:26px;min-width:26px;padding:3px}
#msg-compose .msg-record-top{padding:9px 12px;min-height:45px;gap:18px}
#msg-compose .msg-record-top time{font-size:23px;font-variant-numeric:tabular-nums;font-weight:400;min-width:58px}
#msg-compose .msg-record-actions{padding:12px 12px 9px;min-height:70px}
#msg-compose .msg-record-actions>.round{width:48px;height:48px;padding:10px;box-sizing:border-box}
#msg-compose .msg-record-actions>.round .icon{width:28px;height:28px}
#msg-compose .msg-record-actions>[data-msg=voice-pause]{border:2px solid #ce3f57;border-radius:50%;color:#ce3f57;background:transparent}
#msg-compose .msg-record-actions>[data-msg=voice-pause] .icon{stroke-width:2.5}
#msg-compose .msg-record-actions>[data-msg=voice-cancel]{color:#284e44;background:transparent}
#msg-compose .msg-record-actions>.chat-send{background:var(--brand,#609789);color:white;border:1px solid #5c907e}
#msg-compose .msg-record-actions>:disabled{opacity:.35}
.msg-live-wave i{background:#617d6c;min-width:2px;max-width:4px}
.msg-screen .message-wrap:has(.msg-audio){width:min(310px,88%)}
.msg-audio{width:100%;min-width:0;max-width:100%;gap:9px;padding:6px 0 1px;box-sizing:border-box}
.msg-voice-avatar{position:relative;display:grid;place-items:center;flex:0 0 43px;width:43px;height:43px;border-radius:50%;background:#f4faed;color:#65926f;font:22px Georgia,serif}
.msg-voice-avatar>img{display:block;width:100%;height:100%;border-radius:50%;object-fit:cover}
.msg-voice-avatar>span{position:absolute;right:-4px;bottom:-5px;display:grid;place-items:center;background:#e0f1d8;border-radius:50%;width:19px;height:23px}
.msg-voice-avatar>span .icon{width:18px;height:22px;stroke-width:2}
.msg-audio>button{width:27px;height:35px;padding:0;flex:0 0 27px}
.msg-audio>button .icon{width:24px;height:24px;fill:#537b5c;stroke:#537b5c}
.msg-audio>button[aria-label^="Приостановить"] .icon{fill:none}
.msg-audio-track{min-width:0;padding-bottom:19px}
.msg-audio-bars{height:35px;gap:2px}
.msg-audio-track:after{width:8px;height:8px;top:13px;border-radius:50%;background:#3f6b4b;transform:translateX(-50%)}
.msg-audio-time{font-size:11px;bottom:0}
.msg-screen .message-bubble{-webkit-touch-callout:none;user-select:none;cursor:pointer}
.msg-screen .message-bubble a{user-select:text}
.msg-screen .message-time [data-msg=message-menu]{width:25px;height:24px;opacity:.7}
.msg-selection-bar{gap:8px;padding-left:10px;padding-right:10px;flex-wrap:nowrap}
.msg-selection-bar strong{font-size:13px;flex:1;text-align:center;white-space:nowrap}
.msg-selection-bar [data-msg=delete-selected],.msg-dialog [data-msg^=delete-]{color:#ad3f4f}
.msg-selection-bar button{flex:0 0 36px;width:36px;height:40px}
@media(max-width:360px){#msg-compose .compose-inline{grid-template-columns:29px minmax(0,1fr) 32px 39px;gap:4px}#msg-compose .compose-inline>[data-msg=camera]{width:32px}#msg-compose .compose-inline>[data-msg=voice],#msg-compose .compose-inline>.chat-send{width:39px;height:39px}.msg-screen .message-wrap:has(.msg-audio){width:90%}.msg-voice-avatar{flex-basis:35px;width:35px;height:35px}.msg-audio{gap:7px}}
/* The original message remains the visual anchor of its context menu. */
.msg-context-overlay{position:fixed;inset:0;z-index:9000;background:#f4f2ea55;backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px);overflow:hidden}
.msg-context-panel{position:absolute;display:flex;flex-direction:column;gap:9px;align-items:flex-start;max-width:calc(100vw - 24px);color:#244b40;box-sizing:border-box}
.msg-context-panel.is-own{align-items:flex-end}
.msg-context-reactions{display:flex;align-items:center;justify-content:space-around;gap:1px;flex:none;width:100%;padding:6px;background:#fffffff5;box-shadow:0 3px 18px #23453314;border-radius:28px}
.msg-context-reactions button{display:grid;place-items:center;width:32px;min-width:0;height:35px;padding:0;background:none;font-size:24px}
.msg-context-reactions button:last-child{border-radius:50%;background:#edf0e9;color:#63776b;font:30px/1 sans-serif}
.msg-context-preview{flex:0 1 auto;overflow:hidden;max-width:100%;border-radius:18px;box-shadow:0 3px 12px #23453316}
.msg-context-preview .message-bubble{position:relative;background:#fffefa;border:1px solid #e4e8dc;border-radius:17px;padding:9px 11px 5px;color:#234c3e;font-size:16px;line-height:1.4}
.msg-context-panel.is-own .msg-context-preview .message-bubble{background:#dcefd6;border-color:#d0e4c9}
.msg-context-preview p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.msg-context-preview .message-time{display:flex;justify-content:flex-end;gap:6px;align-items:center;font-size:10px;color:#728878}
.msg-context-preview .message-time button{display:none}
.msg-context-actions{flex:0 1 auto;overflow:auto;overscroll-behavior:contain;min-height:0;width:250px;max-width:100%;padding:9px 14px;background:#fffffff5;border-radius:21px;box-shadow:0 4px 20px #23453312}
.msg-context-actions .list-button{display:flex;align-items:center;width:100%;gap:13px;padding:11px 0;min-height:42px;border:0;background:none;font:inherit;font-size:15px;line-height:1.3;color:#244b40;text-decoration:none}
.msg-context-actions .list-button>.icon{width:21px;height:21px;flex:none}
.msg-context-actions .list-button>.icon:last-child{display:none}
.msg-context-actions .list-button>.icon:first-child{display:block}
.msg-context-actions [data-msg=delete]{color:#b23c50}
.msg-context-actions summary{cursor:pointer;padding:11px 0;font-size:15px}
.msg-context-actions details[open]{border-top:1px solid #e2e8dc}
/* Center the actual pause bars, not only their surrounding SVG box. */
#msg-compose .msg-record-actions>[data-msg=voice-pause],.msg-audio>[data-msg=audio-play]{display:grid;place-items:center;padding:0;line-height:0;text-indent:0}
#msg-compose .msg-record-actions>[data-msg=voice-pause] .icon,.msg-audio>[data-msg=audio-play] .icon{display:block;width:24px;height:24px;margin:0!important;transform:none!important}
#msg-compose .msg-record-actions>[data-msg=voice-pause] .icon path,.msg-audio>[data-msg=audio-play] .icon path{fill:currentColor;stroke:none}
/* Media choices occupy the keyboard area; the input row stays in place. */
.msg-attachments{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px 10px;padding:20px 8px 13px;border-radius:22px 22px 0 0;margin:9px -8px -8px;background:#e8eee5;max-height:42dvh;overflow:auto}
.msg-attachments button{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px;min-width:0;padding:0;background:none;color:#345a47}
.msg-attachments button>span{width:54px;height:54px;display:grid;place-items:center;background:#fffffa;border-radius:50%;color:#477d68}
.msg-attachments .icon{width:27px;height:27px}
.msg-attachments small{font-size:12px;line-height:1.2;text-align:center}
.msg-attachments button:nth-child(2)>span{color:#458dc3}.msg-attachments button:nth-child(3)>span{color:#b69542}
.msg-message.has-photo .message-wrap{position:relative;width:82%;max-width:calc(100% - 40px)}
.msg-message.has-photo .message-bubble{padding:3px;border-radius:17px;position:relative}
.msg-photo-content{width:100%;overflow:hidden;border-radius:14px}
.msg-photo-content a{display:block}.msg-photo-content img{display:block;width:100%;max-width:100%;height:auto;max-height:440px;object-fit:contain}
.msg-message.has-photo .message-time{position:absolute;right:8px;bottom:8px;color:#fff;background:#27382d6b;border-radius:9px;padding:3px 6px;margin:0}
.msg-message.has-photo .message-time .msg-receipt{color:#fff}
.msg-photo-forward{position:absolute;left:-36px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:29px;height:29px;border-radius:50%;background:#6e837b99;color:white;padding:6px}
.incoming .msg-photo-forward{left:auto;right:-36px}.msg-photo-forward .icon{width:18px;height:18px}
.msg-call-card.is-missed>.icon{color:#b94f55}
.msg-day span{font-size:12px;font-weight:600;padding:4px 15px}

/* Keep the document still while only the message history scrolls. */
@media(max-width:699px){
 html.chat-conversation-open,html.chat-conversation-open body{overflow:hidden;overscroll-behavior:none}
 .shell.messenger-shell.conversation-open .msg-screen{height:100%;min-height:0;overflow:hidden}
 .shell.messenger-shell.conversation-open .msg-thread{flex:1;min-height:0;height:100%;overflow:hidden}
 .shell.messenger-shell.conversation-open .msg-messages{flex:1 1 0;min-height:0;overscroll-behavior:contain}
 .shell.messenger-shell.conversation-open #msg-compose{flex:0 0 auto;margin-top:auto}
}

/* Only the name column expands; contact avatars stay circular. */
.msg-dialog .list-button>.msg-avatar{flex:0 0 42px;width:42px;min-width:42px;max-width:42px;height:42px;min-height:42px;max-height:42px;aspect-ratio:1;border-radius:50%;display:grid;place-items:center;overflow:hidden}
.msg-dialog .list-button>.msg-avatar+span{min-width:0;overflow-wrap:anywhere}
