#telegramChats,#telegramMain,#telegramFilters{display:none}
.workspace[data-view="chats"][data-platform="telegram"] #chats,.workspace[data-view="chats"][data-platform="telegram"] #chatSearchMessages,.workspace[data-view="chats"][data-platform="telegram"] #chatFilters,.workspace[data-view="chats"][data-platform="telegram"] #bgAudioBar{display:none!important}
.workspace[data-view="chats"][data-platform="telegram"] #telegramChats{display:block}
.workspace[data-view="chats"][data-platform="telegram"] #telegramFilters{display:flex}
.workspace[data-view="chats"][data-platform="telegram"] .chatpanel>:not(#telegramMain){display:none!important}
.workspace[data-view="chats"][data-platform="telegram"] #telegramMain{display:flex}
.telegram-chats button{display:flex;gap:13px;align-items:center;width:100%;height:70px;box-sizing:border-box;border:0;border-radius:10px;padding:9px 10px;background:transparent;text-align:left;color:inherit;cursor:pointer}
.telegram-chats button:hover{background:var(--ui-hover,#f3f8f4)}
.telegram-chats button.active{background:var(--ui-selected,#dff1e7)}
.telegram-chats .chatitem{height:70px;min-height:70px;margin-bottom:6px}
.telegram-chats .telegram-chat-row{position:relative;height:70px;margin-bottom:6px}
.telegram-chats .telegram-chat-row .chatitem{margin-bottom:0;padding-right:54px}
.telegram-chats .telegram-chat-more{position:absolute;right:5px;top:18px;width:34px;height:34px;padding:0;display:grid;place-items:center;font-size:23px;border-radius:8px;z-index:1}
.telegram-chats .telegram-chat-menu{position:absolute;right:5px;top:56px;z-index:4;min-width:180px;padding:5px;background:var(--ui-pane,#fff);border:1px solid var(--ui-border,#dce7df);border-radius:10px;box-shadow:0 10px 24px #193b2a24}
.telegram-chats .telegram-chat-menu button{height:38px;padding:8px 10px;font-size:13px;white-space:nowrap}
.telegram-chats .avatar{flex:0 0 50px;width:50px;height:50px;border-radius:50%;display:grid;place-items:center;background:var(--ui-accent-surface);color:var(--ui-accent);font-weight:700;overflow:hidden}
.telegram-chats .avatar img,#telegramChatAvatar img{width:100%;height:100%;object-fit:cover}
.telegram-chats .body{min-width:0;flex:1}
.telegram-chats button strong,.telegram-chats button small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.telegram-chats button strong{font-size:16px;font-weight:650}
.telegram-chats button small{margin-top:3px;font-size:13px;color:var(--ui-muted)}
.telegram-chats .chat-trailing{align-self:flex-start;margin-top:5px}
.telegram-chats .telegram-chat-pin{font-size:13px;line-height:1;color:var(--ui-accent,#08745f)}
.telegram-chats .telegram-archived-label{font-size:11px;color:var(--ui-muted,#63786b)}
.telegram-chats .telegram-archive-row{height:70px;margin-bottom:6px;background:var(--ui-hover,#e8f1eb);font-weight:650}
.chats-pane #telegramFilters{flex-wrap:wrap;overflow:visible;padding:0}
.chats-pane #telegramFilters button{min-height:34px;font-size:12px;font-weight:600}
.telegram-main{flex-direction:column;min-width:0;min-height:0;flex:1}
.telegram-main header{display:flex;align-items:center;gap:12px;padding:18px;border-bottom:1px solid var(--ui-border,#dce7df);min-height:70px}
.telegram-main header #telegramChatAvatar:not([hidden]){flex:0 0 44px;width:44px;height:44px;display:grid;place-items:center;overflow:hidden}
.telegram-main header strong{font-size:19px}
.telegram-history-tools{display:flex;align-items:center;gap:7px;margin-left:auto;flex-wrap:wrap;justify-content:flex-end}
.telegram-history-tools[hidden]{display:none}
.telegram-history-tools button{padding:7px 10px;font-size:12px;white-space:nowrap}
.telegram-date-label{display:flex;align-items:center;gap:5px;color:var(--ui-muted);font-size:12px}
.telegram-date-label input{width:125px;padding:6px;border:1px solid var(--ui-field-border);border-radius:8px;background:var(--ui-raised);color:inherit;font:inherit}
#telegramBack{display:none}
.telegram-qr{max-width:430px;margin:auto;padding:24px;text-align:center}
.telegram-qr[hidden],.telegram-composer[hidden],.telegram-qr form[hidden]{display:none!important}
.telegram-qr img{display:block;width:min(100%,300px);margin:20px auto;background:white;padding:10px}
.telegram-qr form{display:grid;gap:10px;text-align:left}
.telegram-qr form input{width:100%;box-sizing:border-box;margin:8px 0;padding:11px;border:1px solid var(--ui-border,#dce7df);border-radius:10px}
.telegram-messages{display:flex;flex-direction:column;gap:9px;flex:1;overflow:auto;padding:20px;background:var(--telegram-canvas)}
.telegram-message-notice{margin:auto;color:var(--ui-muted);text-align:center;max-width:360px;line-height:1.5}
.telegram-message{max-width:min(80%,650px);align-self:flex-start;border-radius:12px;padding:10px 13px;background:var(--ui-pane);white-space:pre-wrap;overflow-wrap:anywhere}
.telegram-message.out{align-self:flex-end;background:var(--telegram-outgoing)}
.telegram-message.media{width:320px;max-width:min(80%,340px);box-sizing:border-box}
.telegram-message.media a{display:block;width:100%}
.telegram-message img{display:block;width:100%;height:240px;border-radius:8px;object-fit:contain;background:var(--ui-raised);cursor:zoom-in}
.telegram-message video{display:block;width:100%;max-height:360px;border-radius:8px;background:#182738}
.telegram-message audio{display:block;width:min(100%,320px)}
.telegram-message>a:not(:first-child){display:inline-block;margin-top:7px}
.telegram-message .telegram-caption{margin-top:7px;white-space:pre-wrap}
.telegram-pin{font-size:12px}
.telegram-message time{display:block;margin-top:4px;text-align:right;font-size:11px;color:var(--ui-muted)}
.telegram-composer{display:flex;border-top:1px solid var(--ui-border,#dce7df);padding:8px}
.telegram-composer input{flex:1;min-width:0;margin:0 8px 0 0;padding:11px;border:1px solid var(--ui-border,#dce7df);border-radius:10px;background:var(--ui-pane,#fff);color:inherit}
@media(max-width:700px){.workspace[data-view="chats"][data-platform="telegram"]:not(.chat-open) .chatpanel{display:none!important}#telegramBack{display:inline-flex}}
@media(max-width:900px){.telegram-main header{flex-wrap:wrap}.telegram-history-tools{width:100%;justify-content:flex-start;margin-left:0}}

/* Telegram colors are scoped to its inbox and account selector. */
:root[data-theme='light']:has(.workspace[data-platform='telegram']) .switch-line-dialog,
:root[data-theme='light'] .workspace[data-view='chats'][data-platform='telegram'] :is(.chats-pane, .chatpanel) {
  --ui-accent: #16669f;
  --ui-focus: #104e7e;
  --ui-accent-surface: #dceeff;
  --ui-selected: #deefff;
  --ui-hover: #edf6fe;
  --ui-raised: #f4f9fe;
  --ui-border: #d6e6f2;
  --ui-field-border: #bad3e5;
  --ui-muted: #4f667c;
  --telegram-canvas: #eaf4fc;
  --telegram-outgoing: #d6ebfb;
}
:root[data-theme='dark']:has(.workspace[data-platform='telegram']) .switch-line-dialog,
:root[data-theme='dark'] .workspace[data-view='chats'][data-platform='telegram'] :is(.chats-pane, .chatpanel) {
  --ui-accent: #91ceff;
  --ui-focus: #b3ddff;
  --ui-on-accent: #132534;
  --ui-accent-surface: #223c56;
  --ui-selected: #253d54;
  --ui-hover: #223548;
  --ui-raised: #1e2c3a;
  --ui-border: #344b60;
  --ui-field-border: #506b83;
  --ui-muted: #b6c9db;
  --telegram-canvas: #151f2b;
  --telegram-outgoing: #233e58;
}
.workspace[data-view='chats'][data-platform='telegram'] :is(#telegramChatAvatar, .telegram-chats .avatar) {
  background: var(--ui-accent-surface);
  color: var(--ui-accent);
}
.workspace[data-view='chats'][data-platform='telegram'] .chatpanel { background: var(--telegram-canvas); }
.workspace[data-view='chats'][data-platform='telegram'] #telegramFilters button.active {
  background: var(--ui-accent-surface);
  border-color: var(--ui-accent);
  color: var(--ui-accent);
}
