#tg-root,#tg-modal{--tg-ink:#183e43;--tg-muted:#728488;--tg-border:#dce7e6;--tg-primary:#147d83;color:var(--tg-ink);font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;font-size:14px;box-sizing:border-box}
#tg-root * ,#tg-modal *{box-sizing:border-box}#tg-root[hidden],#tg-root [hidden]{display:none!important}body.tg-active{overflow:hidden}#tg-root{position:fixed;inset:0;z-index:500;background:#f4f8f7;display:flex;flex-direction:column;height:100dvh}#tg-root button,#tg-modal button{border:1px solid var(--tg-border);border-radius:8px;background:#fff;color:var(--tg-ink);padding:8px 11px;cursor:pointer;font:inherit;white-space:nowrap}#tg-root button:hover,#tg-modal button:hover{background:#edf5f4}#tg-root button:disabled{opacity:.5;cursor:wait}#tg-root input,#tg-root select,#tg-root textarea,#tg-modal input,#tg-modal select{font:inherit;color:var(--tg-ink);border:1px solid var(--tg-border);border-radius:8px;background:#fff;max-width:100%;padding:9px}#tg-root button:focus-visible,#tg-modal button:focus-visible{outline:3px solid #62b9bc;outline-offset:2px}#tg-root .tg-primary,#tg-modal .tg-primary{background:var(--tg-primary);color:white;border-color:var(--tg-primary)}.tg-top{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 22px;background:white;border-bottom:1px solid var(--tg-border)}.tg-brand{display:flex;align-items:center;gap:12px}.tg-brand>span{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:#147d83;color:white;font-size:25px}.tg-brand b{display:block;font-size:18px}.tg-brand small{display:block;color:var(--tg-muted);margin-top:3px}.tg-top-actions{display:flex;gap:8px}#tg-banner{padding:6px 20px;background:#fff1d8;font-size:12px;color:#836013}#tg-banner.online{background:#e6f3ee;color:#34776c}#tg-banner.offline{background:#fff1e4;color:#965414}.tg-body{display:grid;grid-template-columns:280px minmax(300px,1fr) 220px;flex:1;min-height:0}.tg-chats{display:flex;flex-direction:column;background:#fff;border-right:1px solid var(--tg-border);min-width:0}.tg-account-row{display:flex;gap:6px;padding:16px 14px 10px}.tg-account-row select{width:100%;min-width:0}.tg-search{display:flex;gap:5px;padding:0 14px 12px}.tg-search input{width:100%;min-width:0}#tg-chat-list{overflow:auto;flex:1}#tg-root .tg-dialog{width:100%;display:flex;align-items:center;gap:11px;padding:14px;border:0;border-radius:0;white-space:normal;text-align:left}.tg-dialog.selected{background:#e9f4f2!important}.tg-avatar{display:grid;place-items:center;background:#dceceb;width:40px;height:40px;border-radius:50%;font-size:17px;flex:none;color:#25696e}.tg-dialog-copy{flex:1;min-width:0}.tg-dialog-copy b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tg-dialog-copy small{display:block;color:var(--tg-muted);font-size:12px;margin-top:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tg-dialog em{font-style:normal;background:#147d83;color:#fff;padding:2px 6px;border-radius:10px;font-size:11px}.tg-list-foot{display:flex;flex-wrap:wrap;gap:8px;padding:10px;border-top:1px solid var(--tg-border)}.tg-conversation{display:flex;flex-direction:column;min-width:0;min-height:0}.tg-chat-head{display:flex;align-items:center;gap:8px;padding:15px 20px;border-bottom:1px solid var(--tg-border);background:rgba(255,255,255,.85)}.tg-chat-head small{display:block;color:var(--tg-muted);font-size:11px;margin-top:4px}.tg-chat-head b{overflow-wrap:anywhere}.tg-grow{flex:1}#tg-messages{overflow:auto;flex:1;padding:22px;overscroll-behavior:contain;background:radial-gradient(circle at 15% 15%,#e6f0ee,transparent 55%),#f0f5f3}.tg-empty{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:var(--tg-muted)}.tg-empty>span{font-size:46px;color:#a1c7c2}.tg-empty h2{font-size:21px;font-weight:500;color:#476b6d}.tg-empty p{line-height:1.8}.tg-empty-small{padding:15px;line-height:1.7;color:var(--tg-muted);font-size:12px}.tg-message{display:flex;margin:0 0 14px}.tg-message.out{justify-content:flex-end}.tg-bubble{padding:12px 14px 8px;max-width:min(84%,670px);border:1px solid #e2e9e4;border-radius:14px 14px 14px 3px;background:#fff;min-width:110px;box-shadow:0 1px 2px #143c3d05;overflow-wrap:anywhere}.out .tg-bubble{border-color:#cde4dd;background:#dcf0e8;border-radius:14px 14px 3px 14px}.tg-bubble p{white-space:pre-wrap;margin:3px 0 8px;line-height:1.65;user-select:text}.tg-sender{font-size:12px;color:#348b87}.tg-message-meta{color:#69847e;text-align:right;font-size:10px;margin-top:7px}.tg-msg-actions{display:flex;gap:5px;flex-wrap:wrap;margin-top:8px}#tg-root .tg-msg-actions button{border:0;background:transparent;padding:2px 3px;color:#5c817a;font-size:11px}.tg-quote{display:block;border-left:3px solid #63a9a4;padding:6px;color:#5a7976;margin-bottom:7px}.tg-media{background:#ffffff70;border-radius:7px;padding:10px}.tg-media strong{display:block}.tg-media small{display:block;margin:5px 0;color:#739089}.tg-media>div{display:flex;gap:5px}#tg-root .tg-media button{font-size:12px;padding:5px 8px}.tg-compose{padding:12px 20px 14px;background:#fff;border-top:1px solid var(--tg-border)}.tg-compose-tools{display:flex;align-items:center;gap:6px;margin-bottom:10px}.tg-compose-tools label{font-size:11px;color:var(--tg-muted);margin-left:auto;display:flex;align-items:center;gap:3px;white-space:nowrap}.tg-compose-tools input{accent-color:#147d83}#tg-send{display:flex;align-items:flex-end;gap:10px}#tg-text{resize:vertical;width:100%;min-height:58px;max-height:200px;font-size:15px;line-height:1.5}.tg-hint{display:block;color:#93a3a3;font-size:10px;margin-top:7px;line-height:1.5}.tg-jobs{overflow:auto;border-left:1px solid var(--tg-border);background:#fbfdfc;padding:17px 14px}.tg-jobs h3{font-size:13px;margin:0 0 15px}.tg-jobs>p{font-size:11px;color:#92a29f;line-height:1.8}.tg-job{padding:11px;background:white;border:1px solid var(--tg-border);border-radius:9px;margin-bottom:9px}.tg-job b{font-size:12px;display:block}.tg-job small{font-size:10px;display:block;margin:5px 0;color:#698681}.tg-job p{font-size:11px;color:#9c513f;line-height:1.6;margin:6px 0}.tg-job a{font-size:12px;color:#147d83}.tg-job progress{width:100%;height:5px;accent-color:#147d83}.tg-job.failed,.tg-job.uncertain{border-color:#e8bba8}#tg-attachments{background:#fff;padding:0 20px;max-height:100px;overflow:auto}#tg-attachments>div{padding:5px 0;font-size:12px;display:flex;align-items:center;gap:9px}#tg-attachments label{margin-left:auto;white-space:nowrap}#tg-reply{padding:9px 20px;background:#e2f0eb;font-size:12px;overflow-wrap:anywhere}#tg-root .tg-mobile{display:none}#tg-toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);z-index:1100;background:#183e43;color:#fff;padding:12px 18px;border-radius:10px;max-width:90vw;box-shadow:0 7px 35px #0002}.tg-load{display:block;margin:0 auto 16px}.tg-search-label{text-align:center;padding:9px;color:#4b7f7d;font-size:12px}#tg-modal{z-index:900;border:1px solid var(--tg-border);border-radius:16px;padding:25px;width:min(580px,94vw);max-height:86dvh;background:#fff;box-shadow:0 16px 60px #1234}#tg-modal::backdrop{background:#143c3f66;backdrop-filter:blur(4px)}#tg-modal h2{margin:0 25px 18px 0;font-size:20px}#tg-modal p{line-height:1.8;color:#607e7c;font-size:13px}#tg-modal label{display:block;margin:12px 0}#tg-modal label input,#tg-modal select{display:block;width:100%;margin-top:7px}#tg-modal .tg-modal-close{position:absolute;right:14px;top:12px;border:0;font-size:22px}#tg-modal .tg-note{font-size:11px;color:#8c9a97}.tg-account-cards>div{padding:13px;border:1px solid var(--tg-border);border-radius:10px;margin-bottom:10px}.tg-account-cards small{display:block;margin-top:5px;color:#538e83}.tg-qr{width:260px;max-width:100%;display:block;margin:15px auto}.tg-preview{width:auto;max-width:100%;max-height:65vh;display:block;margin:auto}.tg-picker{display:flex;flex-direction:column;gap:7px;max-height:45vh;overflow:auto;margin:15px 0}.tg-picker button{text-align:left;white-space:normal!important;overflow-wrap:anywhere}.tg-picker small{float:right;color:#859b96}#tg-modal hr{border:0;border-top:1px solid var(--tg-border);margin:20px 0}
@media(max-width:1120px){.tg-body{grid-template-columns:260px minmax(0,1fr)}.tg-jobs{display:none}#tg-root .tg-top{padding:10px 14px}.tg-conversation{position:relative}.tg-jobs:has(.running),.tg-jobs:has(.failed),.tg-jobs:has(.done){display:none}}
@media(max-width:700px){.tg-body{display:block;position:relative}.tg-chats,.tg-conversation{height:100%;width:100%}.tg-conversation{display:none}.tg-chat-open .tg-chats{display:none}.tg-chat-open .tg-conversation{display:flex}#tg-root .tg-mobile{display:block}.tg-top{gap:7px}.tg-brand>span{width:29px;height:29px;font-size:20px;border-radius:9px}.tg-brand{gap:7px}.tg-brand b{font-size:15px}.tg-brand small{display:none}.tg-top-actions{gap:5px}#tg-root .tg-top-actions button{font-size:11px;padding:7px}.tg-chat-head{padding:10px 12px}.tg-chat-head>button{font-size:12px!important;padding:6px!important}.tg-chat-head b{font-size:14px}.tg-compose{padding:10px 12px max(10px,env(safe-area-inset-bottom))}.tg-compose-tools{gap:4px}#tg-root .tg-compose-tools button{font-size:11px;padding:7px}.tg-compose-tools label{font-size:10px}#tg-messages{padding:14px 11px}.tg-bubble{max-width:90%;font-size:14px}.tg-hint{font-size:9px}#tg-text{font-size:16px;min-height:56px}.tg-top-actions [data-tg=sound]{max-width:83px}#tg-modal input{font-size:16px}.tg-msg-actions{opacity:1}#tg-toast{bottom:22px;width:max-content}.tg-media>div{flex-wrap:wrap}#tg-banner{font-size:10px;padding:5px 12px}.tg-account-row{padding:12px}.tg-dialog-copy small{max-width:70vw}}
#tg-root .tg-compose-tools label{flex-direction:row}#tg-root .tg-compose-tools input[type=checkbox]{width:auto;margin:0;flex:none}#tg-root .tg-compose-tools{min-height:34px}
@media(max-width:380px){#tg-root .tg-top{flex-wrap:wrap}#tg-root .tg-top-actions{width:100%;justify-content:flex-end}#tg-root .tg-brand{margin-bottom:1px}}
#tg-modal .tg-bark-card{padding:13px;border:1px solid var(--tg-border);border-radius:10px;margin-bottom:10px;overflow-wrap:anywhere}#tg-modal .tg-bark-card small{display:block;color:#668580;margin-top:6px;font-size:11px}#tg-modal .tg-bark-card p{margin:7px 0;font-size:12px}#tg-modal .tg-bark-actions{display:flex;flex-wrap:wrap;gap:6px}#tg-modal .tg-bark-actions button{font-size:12px}#tg-modal .tg-check{display:flex;align-items:center;gap:8px;line-height:1.6}#tg-modal .tg-check input[type=checkbox]{width:auto;margin:0;flex:none;accent-color:var(--tg-primary)}#tg-modal fieldset{border:1px solid var(--tg-border);border-radius:8px;margin:12px 0;padding:10px}#tg-modal fieldset:disabled{opacity:.45}#tg-modal .tg-bark-error{color:#a14532}

#tg-root .tg-compose-tools small{margin-left:auto;font-size:11px;color:var(--tg-muted)}
#tg-root textarea,#tg-root .tg-bubble p{-webkit-user-select:text;user-select:text;touch-action:auto}
#tg-modal .tg-picker button{min-height:44px}#tg-root .tg-bubble p{font-size:16px}
@media(max-width:700px){#tg-root button,#tg-modal button{min-height:40px}#tg-root select,#tg-modal select{font-size:16px}#tg-root .tg-compose-tools{flex-wrap:wrap}.tg-top-actions{flex-wrap:wrap}#tg-modal{padding:18px}.tg-account-cards button{margin:3px 0}}

/* Bound the grid row itself: long chat lists must never push the composer off screen. */
#tg-root{overflow:hidden}.tg-body{grid-template-rows:minmax(0,1fr);overflow:hidden}
.tg-chats,#tg-chat-list,#tg-messages,.tg-jobs{min-height:0}.tg-chats,.tg-conversation{overflow:hidden}
.tg-top,#tg-banner,.tg-account-row,.tg-search,.tg-list-foot,.tg-chat-head,.tg-compose,#tg-reply{flex-shrink:0}
#tg-attachments{flex-shrink:0}#tg-text{max-height:min(200px,22dvh)}
@media(max-height:600px){.tg-top{padding:6px 12px}.tg-brand small,.tg-hint{display:none}.tg-chat-head{padding:6px 12px}.tg-compose{padding:6px 12px}.tg-compose-tools{margin-bottom:5px}#tg-text{min-height:42px;height:48px}.tg-brand>span{height:28px;width:28px}}

/* Bark uses a scrollable form with a separate, always-visible action bar. */
#tg-modal.tg-bark-view[open]{display:flex;flex-direction:column;height:min(86dvh,780px);overflow:hidden}
#tg-modal.tg-bark-view>h2,#tg-modal.tg-bark-view>form{flex:none}
#tg-modal.tg-bark-view .tg-modal-content{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
#tg-modal .tg-bark-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding-right:4px}
#tg-modal .tg-bark-scroll>p:first-child{margin-top:0}
#tg-modal .tg-bark-footer{flex:none;padding-top:12px;margin-top:12px;border-top:1px solid var(--tg-border);background:#fff}
#tg-modal .tg-bark-footer .tg-bark-actions{justify-content:space-between}
#tg-modal .tg-bark-footer button{min-height:42px}
#tg-modal #tg-bark-status{margin:0 0 10px;overflow-wrap:anywhere;max-height:90px;overflow:auto}
#tg-modal .tg-check{flex-direction:row;text-align:left;justify-content:flex-start}
#tg-modal .tg-check input[type=checkbox]{width:18px;height:18px;padding:0;min-height:0}
#tg-modal [hidden]{display:none!important}
@media(max-width:700px){#tg-modal.tg-bark-view{height:90dvh;max-height:90dvh;padding:16px}#tg-modal .tg-check span{font-size:14px}}

#telegramLauncher{display:inline-flex;align-items:center;text-decoration:none;color:inherit}
#tg-root .tg-window-link{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border:1px solid var(--tg-border);border-radius:8px;background:#fff;color:var(--tg-ink);padding:8px 11px;font:inherit;white-space:nowrap}
#tg-modal #tg-template-form textarea{display:block;width:100%;font:inherit;padding:9px;border:1px solid var(--tg-border);border-radius:8px;margin-top:7px;resize:vertical;min-height:100px;max-height:260px}
#tg-modal .tg-template-preview{border:1px solid var(--tg-border);border-radius:10px;padding:12px;overflow-wrap:anywhere}#tg-template-body{white-space:pre-wrap}
@media(max-width:700px){#tg-root .tg-window-link{font-size:11px;padding:7px;min-height:40px}#tg-modal #tg-template-form textarea{font-size:16px}}

/* Bark private routes: forms keep the action bar within the mobile viewport. */
.tg-route-binding {padding:10px 0;border-bottom:1px solid var(--tg-line,#ddd)}
.tg-route-binding input[type=text]{width:100%;box-sizing:border-box;margin-top:6px}
.tg-bark-card>select{max-width:100%;margin:5px 0}
.tg-bark-scroll pre{white-space:pre-wrap;overflow-wrap:anywhere;padding:10px;background:#f1f5f9;color:#172033}
#tg-server-form,#tg-routing-form{margin-top:16px;padding-top:12px;border-top:1px solid #ddd}

/* Compact account overview remains visible while a conversation is open on mobile. */
#tg-account-badges{display:flex;gap:6px;align-items:center;overflow-x:auto;flex:none;padding:6px 14px;background:#fff;border-bottom:1px solid var(--tg-border);min-height:42px;scrollbar-width:thin}
#tg-account-badges a{display:flex;align-items:center;gap:7px;flex:none;max-width:240px;text-decoration:none;color:#46716f;border:1px solid #dce7e6;border-radius:18px;padding:5px 11px;font-size:12px}
#tg-account-badges a span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#tg-account-badges a.current{background:#e3f2ed;border-color:#80bab0;color:#165e58}#tg-account-badges em{background:#b74937;color:#fff;border-radius:10px;padding:1px 6px;font-style:normal;font-size:11px}
#tg-root .tg-folder-tabs{display:flex;gap:5px;padding:0 12px 8px;flex:none}#tg-root .tg-folder-tabs button{flex:1;padding:7px;font-size:13px}#tg-root .tg-folder-tabs [aria-pressed=true]{background:#dcefeb;color:#17635c;border-color:#97c7bc}
#tg-contact-banner{flex:none;background:#f8f3e6;padding:7px 14px;font-size:12px;color:#736144}#tg-root #tg-contact-banner button{font-size:12px;padding:5px 9px;margin:2px}
#tg-modal textarea{display:block;width:100%;font:inherit;padding:10px;border:1px solid var(--tg-border);border-radius:8px;resize:vertical;min-height:80px}#tg-privacy-rules form{border-bottom:1px solid var(--tg-border);padding:7px 0 15px}#tg-privacy-rules small{color:var(--tg-muted)}#tg-volume{padding:0!important;accent-color:#147d83}#tg-modal [hidden]{display:none!important}
@media(max-width:700px){#tg-account-badges{padding:5px 9px}#tg-account-badges a{min-height:32px;max-width:180px}#tg-root .tg-top{padding:8px 10px}#tg-root .tg-top-actions{gap:4px}#tg-root .tg-top-actions button{padding:5px;font-size:11px}#tg-root .tg-brand small{display:none}#tg-root .tg-chat-head{padding:8px;gap:5px}#tg-root .tg-chat-head>div:first-of-type{min-width:0;flex:1}#tg-root .tg-chat-head b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#tg-root .tg-chat-head .tg-grow{display:none}#tg-contact-banner{padding:5px 9px}#tg-modal textarea{font-size:16px}}
@media(max-width:420px){#tg-root .tg-brand>div{display:none}#tg-root .tg-brand{flex:none;margin:0}#tg-root .tg-top{flex-wrap:nowrap;gap:5px}#tg-root .tg-top-actions{width:auto;flex:1;flex-wrap:nowrap;justify-content:flex-end}#tg-root .tg-top-actions .tg-window-link{padding:7px;font-size:11px}}
/* Visual keyboard may shrink visualViewport without changing CSS media-query height. */
#tg-root.tg-compact .tg-hint,#tg-root.tg-compact #tg-contact-banner{display:none!important}
#tg-root.tg-compact .tg-compose{padding:6px 12px}#tg-root.tg-compact .tg-compose-tools{margin-bottom:5px}
#tg-root.tg-compact #tg-text{min-height:42px;height:48px;max-height:80px}#tg-root.tg-compact #tg-attachments{max-height:50px}

/* Keep the mobile chat composer area unchanged; TCP remains in account settings. */
@media(max-width:700px){#tg-root .tg-top-actions .tg-tcp-link{display:none}}
