/* Telegram's conversation rhythm, in the platform's charcoal/lavender world. */
.main[data-page=messages]{--chat-canvas:#f1eef5;--chat-ink:#282331;--chat-muted:#665d73}
.main[data-page=messages] .page-content{padding-top:0;min-height:0}
.main[data-page=messages] .topbar{padding-top:18px;padding-bottom:14px;min-height:0}
.main[data-page=messages] .topbar h1{font-size:32px}
.messenger-shell{grid-template-columns:minmax(250px,29%) minmax(0,1fr);background:var(--chat-canvas);border-radius:16px;min-height:0}
.chat-directory{background:#fff;border-color:#e3dee9}
.chat-search{padding:16px 14px 12px}
.chat-search input{border:0;background:#f2eff6;border-radius:12px;min-height:44px;padding-left:14px;font-size:14px}
#chat-rooms{padding:0 8px 12px;scrollbar-gutter:stable}
.chat-room{border:0;min-height:78px;padding:12px 10px;gap:12px;border-radius:12px}
.chat-room:hover{background:#f3eff9}.chat-room.active{background:#e8def8}
.chat-room .avatar{width:46px;height:46px;min-width:46px;font-size:17px}
.chat-room strong{font-size:14px;line-height:1.5}.chat-room small{color:var(--chat-muted);font-size:12px;line-height:1.5}
.chat-unread{background:#675080;color:#fff;min-width:24px;line-height:18px;border-radius:12px;padding:2px 6px}
.chat-header{background:white;border-color:#e3dee9;gap:10px;padding:10px 18px;min-height:68px}
.chat-header>.avatar{width:42px;height:42px;min-width:42px}
.chat-header .chat-info{height:44px;min-height:44px;display:flex;flex-direction:column;justify-content:center;gap:2px;align-items:flex-start;overflow:hidden}
.chat-info strong{font-size:15px;line-height:1.5;max-width:100%}.chat-info small{color:var(--chat-muted);line-height:1.4}
.chat-header .icon-button{background:transparent;border:0;color:#62546f;width:44px;min-width:44px;height:44px;padding:11px}
.chat-timeline{padding:12px clamp(16px,4vw,64px) 18px;scrollbar-gutter:stable;overflow-anchor:none;position:relative;background:var(--chat-canvas)}
.chat-day{display:flex;justify-content:center;margin:12px 0 18px;clear:both;font-size:11px;color:#5f546b;user-select:none}
.chat-day span{background:#e5dfee;border-radius:10px;padding:4px 10px}
.chat-message{max-width:88%;gap:8px;margin:10px 0 0;align-items:flex-end;position:relative;min-width:0;scroll-margin:40px;touch-action:pan-y}
.chat-message.is-joined{margin-top:3px}.chat-message.group-end{margin-bottom:12px}
.chat-message.mine{flex-direction:row;margin-left:auto;justify-content:flex-end}
.chat-message .chat-message-body{min-width:0;max-width:100%;display:flex;flex-direction:column;align-items:flex-start}
.chat-message.mine .chat-message-body{align-items:flex-end}
.chat-bubble{background:#fff;color:var(--chat-ink);border-radius:14px 14px 14px 5px;padding:9px 12px 7px;box-shadow:0 1px 2px #2419310a;max-width:100%;min-width:76px}
.chat-message.mine .chat-bubble{background:#e7dcf8;border-radius:14px 14px 5px 14px}
.chat-message.is-joined .chat-bubble{border-top-left-radius:5px}.chat-message.mine.is-joined .chat-bubble{border-top-left-radius:14px;border-top-right-radius:5px}
.chat-author{display:block;font:700 12px/1.5 Manrope,sans-serif;color:#65427f;margin:0 0 3px}
.chat-text{font-size:14px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere;user-select:text}
.chat-text.is-deleted{font-size:12px;font-style:italic;color:var(--chat-muted)}
.chat-message-meta{display:flex;justify-content:flex-end;align-items:center;gap:4px;font-size:10px;line-height:1.4;color:#655673;margin-top:3px;min-height:14px;user-select:none}
.chat-message-meta svg{width:12px;height:12px;vertical-align:middle;stroke-width:1.8}.chat-message-meta .chat-delivery svg{width:19px}
.chat-author-avatar{width:30px!important;height:30px!important;min-width:30px!important;font-size:12px!important}.avatar-spacer{visibility:hidden}
.chat-message-menu{flex:none;align-self:center;background:transparent;border:0;color:#766588;min-width:36px;width:36px;height:36px;min-height:36px;padding:8px;opacity:0;transition:opacity .15s}
.chat-message.mine .chat-message-menu{order:-1}.chat-message:hover .chat-message-menu,.chat-message:focus-within .chat-message-menu{opacity:1}
.chat-reply-reference{display:flex;align-items:center;gap:6px;padding:7px 9px;background:#eae3f3;border:0;border-radius:8px;margin-bottom:6px;color:#543a70;min-height:36px;font-size:12px;line-height:1.4}
.chat-reply-reference span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-reply-reference svg{width:15px;height:15px;flex:none}
.chat-message.mine .chat-reply-reference{background:#d9c9ee}
.chat-reactions{display:flex;flex-wrap:wrap;gap:4px;max-width:100%;padding:4px 0 0}
.chat-reaction{display:flex;gap:5px;align-items:center;min-width:44px;min-height:32px;padding:3px 8px;border:0;background:#e2dbe9;color:#4d365e;border-radius:11px;font:600 11px/1.3 Manrope,sans-serif;cursor:pointer}
.chat-reaction.is-mine{background:#62477c;color:white}.chat-reaction:hover{filter:brightness(.97)}
.reaction-emoji{font-size:18px;line-height:1.3}.reaction-people{display:flex;padding-left:3px}.reaction-people .avatar{height:18px;width:18px;min-width:18px;border-radius:50%;margin-left:-3px;font-size:9px;flex:none;background:#f7f3fc;color:#513b67;border:1px solid #fff}
.reaction-count{font-variant-numeric:tabular-nums}.reaction-settle{animation:chat-reaction-settle .28s cubic-bezier(.16,1,.3,1)}
@keyframes chat-reaction-settle{from{transform:scale(.94)}60%{transform:scale(1.035)}to{transform:scale(1)}}
.chat-message.has-sticker .chat-bubble{position:relative;background:transparent;box-shadow:none;padding:0;border-radius:0;min-width:0}
.chat-sticker{display:block;width:clamp(150px,19vw,226px);height:auto;aspect-ratio:1;object-fit:contain;user-select:none;pointer-events:none}
.has-sticker .chat-message-meta{width:max-content;margin:0 0 0 auto;padding:3px 7px;background:#e1d9eb;border-radius:8px;color:#544161}
.has-sticker .chat-reply-reference{background:#e0d6eb;max-width:230px}.has-sticker .chat-author{margin-left:8px}
.chat-file{margin-top:6px;max-width:100%}.chat-file>a{line-height:1.5}.chat-file>a>span{min-width:0;overflow-wrap:anywhere}.chat-file>a>small{white-space:nowrap}.chat-file>a>svg{flex:none}
.chat-pinned{background:#fff;padding:5px 18px;border-color:#e3dee9}.chat-pinned button{min-height:40px;padding:4px 0;gap:12px;color:#65427f}
.chat-pinned svg{flex:none;width:18px;height:18px}.chat-pinned span{line-height:1.5}
.chat-find{background:white;padding:8px 18px}.chat-find input{background:#f4f1f8;border:0;min-height:44px}
.chat-compose{border:0;background:var(--chat-canvas);padding:10px 18px calc(12px + env(safe-area-inset-bottom));position:relative}
.chat-composer-row{display:flex;align-items:flex-end;flex-wrap:nowrap!important;gap:2px;padding:5px 6px;background:white;border-radius:18px;min-height:54px}
.chat-composer-row>textarea{order:0!important;flex:1!important;min-width:0;background:transparent!important;border-radius:0;padding:10px 6px;min-height:44px;font:14px/1.6 Manrope,sans-serif;box-shadow:none!important;outline:none!important}
.chat-composer-row>.icon-button{width:40px!important;min-width:40px!important;height:44px;min-height:44px;padding:10px!important;border:0;background:transparent;color:#695778;border-radius:12px}
.chat-composer-row #chat-send{background:#242026;color:#fff;border-radius:13px;margin-left:4px}.chat-composer-row #chat-dictate{margin-left:0}
.chat-context{background:white;border-radius:12px;padding:7px 10px;margin-bottom:6px;min-height:40px;color:#65427f}
.chat-action-menu{position:fixed;z-index:1100;overflow-y:auto;overscroll-behavior:contain;background:white;color:var(--chat-ink,#282331);border-radius:16px;padding:8px;box-shadow:0 12px 44px #2419312e;animation:chat-panel-in .18s cubic-bezier(.16,1,.3,1);transform-origin:top center}
.chat-quick-reactions{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));padding:0 0 6px;gap:1px;border-bottom:1px solid #ece6f2}
.chat-quick-reactions>button{background:transparent;border:0;min-width:44px;min-height:44px;padding:5px;font-size:25px;border-radius:10px}.chat-quick-reactions>button[aria-pressed=true]{background:#e8dcf7}
.chat-quick-reactions>.icon-button{width:44px;height:44px;padding:12px}.chat-action-list{display:grid;padding-top:4px;gap:1px}
.chat-action-list>button{display:flex;align-items:center;gap:14px;width:100%;min-height:44px;padding:9px 12px;border:0;border-radius:10px;background:transparent;font:500 13px/1.5 Manrope,sans-serif;justify-content:flex-start}
.chat-action-list>button:hover,.chat-quick-reactions>button:hover{background:#f2edf8}.chat-action-list svg{width:19px;height:19px;flex:none}.chat-action-list>.danger{color:#a83e48}
.chat-media-panel{flex:none;display:flex;flex-direction:column;height:min(370px,46dvh);min-height:150px;max-height:48%;background:#fff;margin:0 18px;border-radius:16px;overflow:hidden;animation:chat-panel-in .22s cubic-bezier(.16,1,.3,1)}
@keyframes chat-panel-in{from{transform:translateY(8px);opacity:.6}to{transform:none;opacity:1}}
.chat-media-panel>header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 8px 0 12px;min-height:48px;flex:none}
.chat-media-tabs{display:flex;gap:6px;align-items:center}.chat-media-tabs>button{padding:7px 12px;min-height:40px;border:0;border-radius:10px;background:transparent;font:600 13px/1.5 Manrope,sans-serif;color:#625371}.chat-media-tabs>button.active{color:#372347;background:#e8ddf9}.chat-media-tabs>strong{font-size:14px}
.chat-media-panel>header>.icon-button{width:44px;min-width:44px;min-height:44px;background:transparent;border:0;padding:12px}
.chat-media-search{display:flex;align-items:center;gap:8px;padding:0 12px;margin:2px 12px 4px;border-radius:10px;background:#f3f0f7;min-height:40px;flex:none}
.chat-media-search>svg{width:17px;height:17px;color:#70627e;flex:none}.chat-media-search input{background:transparent;border:0;padding:8px 0;min-height:40px;min-width:0;font-size:13px;width:100%;box-shadow:none!important;outline:none!important}
.chat-media-categories{display:flex;flex:none;gap:2px;overflow-x:auto;padding:0 10px;scrollbar-width:none;overscroll-behavior:contain;min-height:44px}
.chat-media-categories>button{flex:none;padding:6px;min-width:40px;min-height:40px;background:transparent;border:0;border-radius:9px;font-size:21px}.chat-media-categories>button svg{height:19px;width:19px}.chat-media-categories>button.active{background:#e8ddf9}
.chat-media-items{overflow:auto;overscroll-behavior:contain;min-height:0;padding:0 10px 10px;scrollbar-gutter:stable;flex:1}
.chat-media-items h3{font:600 11px/1.4 Manrope,sans-serif;color:#6c5d78;margin:6px 6px}
.chat-emoji-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(44px,1fr));gap:0}
.chat-emoji-grid>button{border:0;min-width:44px;min-height:44px;height:44px;background:transparent;border-radius:10px;padding:4px;font-size:26px;line-height:1.3}
.chat-emoji-grid>button:hover,.chat-sticker-grid>button:hover{background:#f1ebf8}
.chat-sticker-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(94px,1fr));gap:4px}
.chat-sticker-grid>button{background:transparent;border:0;border-radius:12px;padding:6px;display:grid;place-items:center;aspect-ratio:1;min-width:0;cursor:pointer}
.chat-sticker-grid img{max-width:100%;width:110px;height:auto;aspect-ratio:1;object-fit:contain;pointer-events:none}
.chat-media-error{color:#a83e48;background:#fff2f3;font-size:12px;margin:4px 10px 8px;padding:8px;flex:none}
.chat-file-info{display:flex;align-items:center;gap:10px;margin-top:5px;min-width:0}.chat-file-info>span{flex:1;min-width:0}.chat-file-info strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500}.chat-file-info small{font-size:10px;color:#665974}.chat-file-info .chat-download{display:grid;place-items:center;min-width:40px;width:40px;height:40px;min-height:40px;padding:10px;flex:none;background:#fff9;color:#594071;border:0;text-decoration:none;border-radius:10px}.chat-download svg{width:20px;height:20px}.chat-forwarded{display:flex;align-items:center;gap:6px;margin-bottom:6px;font-size:11px;color:#624776;line-height:1.5}.chat-forwarded svg{width:15px;height:15px;flex:none}.chat-forwarded strong{font-weight:600}
.chat-action-menu button:focus-visible,.chat-media-panel button:focus-visible,.chat-reaction:focus-visible,.chat-message-menu:focus-visible{outline:2px solid #765294;outline-offset:-2px}
@media(max-width:1100px){.messenger-shell{display:block}.chat-directory{height:100%;border:0}.chat-conversation{display:none;height:100%;min-height:0}.messenger-shell.chat-open .chat-directory{display:none}.messenger-shell.chat-open .chat-conversation{display:flex}.chat-header .chat-back{display:flex}.chat-timeline{padding-left:14px;padding-right:14px}.chat-message{max-width:95%}.chat-header{padding:8px 12px}.chat-media-panel{margin:0 12px}.chat-compose{padding-left:12px;padding-right:12px}}
@media(pointer:coarse){.chat-message-menu{opacity:1;min-width:28px;width:28px;padding:5px}.chat-reaction{min-height:36px}}
@media(max-width:760px){
 .main[data-page=messages]{height:var(--ui-visible-height,100dvh);min-height:0}
 .main[data-page=messages] .topbar{padding:8px 12px;min-height:60px;height:60px;gap:8px;flex:none}
 .main[data-page=messages] .topbar h1{font-size:27px!important}
 .main[data-page=messages] .page-content{padding:0 6px 6px!important;flex:1;min-height:0}
 .messenger-shell{display:block;border-radius:14px;height:100%;min-height:0}
 .chat-header{gap:5px;padding:7px 6px;min-height:62px}.chat-header>.avatar{width:36px;height:36px;min-width:36px}
 .chat-header .chat-info{margin-left:4px}.chat-info strong{font-size:14px}.chat-info small{font-size:11px}
 .chat-header>.icon-button{width:40px;min-width:40px;padding:10px}.chat-header .chat-back{display:flex}
 .chat-conversation{height:100%;min-height:0}
 .chat-timeline{padding:6px 10px 14px;scrollbar-width:none}.chat-timeline::-webkit-scrollbar{display:none}
 .chat-message{max-width:96%;gap:4px}.chat-message .chat-bubble{max-width:100%;padding:8px 11px 6px}.chat-message.mine .chat-bubble{max-width:100%}
 .chat-text{font-size:14px;line-height:1.55}.chat-author-avatar{width:25px!important;height:25px!important;min-width:25px!important}
 .chat-message-menu{width:24px;min-width:24px;height:36px;padding:4px;opacity:1}.chat-message-menu svg{width:17px;height:17px}
 .chat-sticker{width:188px}.chat-message.has-sticker .chat-bubble{padding:0}
 .chat-day{margin:10px 0 14px}.chat-compose{padding:7px 6px calc(7px + env(safe-area-inset-bottom))}
 .chat-composer-row{gap:0;padding:3px;border-radius:16px}.chat-composer-row>.icon-button{width:36px!important;min-width:36px!important;padding:8px!important}
 .chat-composer-row>textarea{padding-left:4px;padding-right:4px;font-size:16px;line-height:1.45;min-height:44px}.chat-composer-row #chat-send{margin-left:3px;width:40px!important;min-width:40px!important}
 .chat-context{margin-bottom:5px}.chat-pinned{padding:4px 12px}.chat-find{padding:6px 10px}
 .chat-media-panel{margin:0 6px;height:min(340px,44dvh);max-height:48%;border-radius:14px}
 .chat-media-search{margin-left:8px;margin-right:8px}.chat-media-categories{padding-left:6px;padding-right:6px}
 .chat-media-categories>button{min-width:36px;padding:5px}.chat-media-items{scrollbar-width:none;padding:0 6px 8px}.chat-media-items::-webkit-scrollbar{display:none}
 .chat-sticker-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.chat-sticker-grid>button{padding:3px}
 .chat-action-menu{scrollbar-width:none}
 .keyboard-open .main[data-page=messages] .topbar{height:48px;min-height:48px;padding-top:2px;padding-bottom:2px}
 .keyboard-open .chat-media-panel{max-height:50%;height:230px;min-height:120px}
 .keyboard-open .chat-media-panel:has(input:focus) .chat-media-categories{display:none}
 .keyboard-compact .chat-header{min-height:48px;padding-top:2px;padding-bottom:2px}.keyboard-compact .chat-header>.avatar{display:none}
 .keyboard-compact .chat-compose{padding-top:3px;padding-bottom:3px}.keyboard-compact .chat-pinned{display:none}
}
@media(prefers-reduced-motion:reduce){.chat-media-panel,.chat-action-menu,.reaction-settle{animation:none}.chat-message-menu{transition:none}}
