:root{font-family:Inter,ui-sans-serif,system-ui,sans-serif;color:#17221d;background:#eef3f0;--line:#cfdbd3;--green:#1f6b50;--green-dark:#134c37;--soft:#f5f8f6;--danger:#9f2f36}*{box-sizing:border-box}html,body{margin:0;min-width:0;max-width:100%;overflow-x:hidden}body{min-height:100vh}button,select,input,textarea{font:inherit;min-width:44px;min-height:44px}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.62}.app-header{min-height:76px;padding:12px 24px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:16px}.brand,.header-actions,.composer-actions,.dialog-actions,.head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.brand-mark{width:44px;height:44px;border-radius:14px;background:var(--green);color:#fff;display:grid;place-items:center;font-weight:800}h1,h2,h3,p{margin:0}h1{font-size:24px}.eyebrow,.section-title{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:#64756b}.safe{padding:9px 12px;border-radius:999px;background:#e3f4e9;color:#18583f;font-weight:700}.primary,.quiet,.danger{border:1px solid var(--line);border-radius:12px;padding:10px 16px;background:#fff;color:#17221d}.primary{border-color:var(--green);background:var(--green);color:#fff}.danger{border-color:#e7c3c5;color:var(--danger);background:#fff7f7}.icon-button{display:grid;place-items:center;width:44px;height:44px;padding:0;border-color:transparent;background:transparent}.icon-button .glyph{display:grid;place-items:center;width:28px;height:28px;border:1px solid transparent;border-radius:9px;line-height:1}.icon-button:hover .glyph{border-color:#dfe8e2;background:#f7faf8}.icon-button:focus-visible{outline:3px solid #165fdd;outline-offset:-3px}.auth-layout{min-height:calc(100vh - 76px);display:grid;place-items:center;padding:32px}.auth-card{width:min(920px,100%);background:#fff;border:1px solid var(--line);border-radius:24px;padding:32px;box-shadow:0 18px 50px rgba(18,54,40,.08)}.auth-card>h2{max-width:700px;font-size:clamp(28px,4vw,46px);line-height:1.08;margin:10px 0 14px}.auth-card>p{max-width:720px;color:#5e6e65;line-height:1.6}.auth-options{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:28px}.auth-options>section,.auth-options>form{border:1px solid var(--line);border-radius:18px;padding:20px;display:grid;gap:12px;align-content:start}.auth-options p{color:#64756b;line-height:1.5}.auth-options label,.search-label,.composer label{font-size:13px;font-weight:700}.auth-options input,.chat-rail input,.composer textarea{width:100%;border:1px solid var(--line);border-radius:12px;padding:10px 12px;background:#fff}.qr-panel{display:grid;place-items:center;gap:12px}.qr-placeholder,.qr-image{width:168px;height:168px;border-radius:16px;background:#fff;border:10px solid #fff;box-shadow:0 0 0 1px var(--line)}.qr-placeholder{padding:18px;background:repeating-conic-gradient(#17221d 0 25%,#fff 0 50%) 0/28px 28px}.qr-image{object-fit:contain}.workspace-layout{display:grid;grid-template-columns:260px minmax(360px,1fr);gap:1px;min-height:calc(100vh - 76px);background:var(--line)}.workspace-layout.rail-collapsed{grid-template-columns:72px minmax(360px,1fr)}.workspace-layout>*{min-width:0;background:#fff;padding:20px}.account-card{display:grid;gap:4px;padding:14px;border-radius:14px;background:var(--soft);margin-bottom:18px}.account-card small{color:#64756b}.search-label{display:block;margin-bottom:7px}.section-title{display:flex;justify-content:space-between;margin:22px 0 10px}.chat-row{margin:3px 0}.chat{position:relative;display:grid;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:9px;width:100%;min-width:0;min-height:54px;text-align:left;border:0;border-radius:12px;background:transparent;padding:7px 8px}.chat-main span,.chat-main small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-main small{color:#68786f;margin-top:3px}.chat-avatar-wrap{position:relative;width:34px;height:34px}.chat-avatar{display:grid;place-items:center;width:34px;height:34px;border-radius:11px;background:#527567;color:#fff;font-size:11px;font-weight:800}.chat-type{position:absolute;right:-4px;bottom:-3px;display:grid;place-items:center;width:15px;height:15px;border:2px solid #fff;border-radius:999px;background:#fff;color:#4f6659;font-size:9px}.rail-toggle{padding:0;width:44px}.chat-rail.collapsed{padding:14px}.chat-rail.collapsed .account-card,.chat-rail.collapsed .search-label,.chat-rail.collapsed #chat-search,.chat-rail.collapsed .rail-copy,.chat-rail.collapsed #chat-count,.chat-rail.collapsed .chat-main{display:none}.chat-rail.collapsed .section-title{justify-content:center;margin:0 0 10px}.chat-rail.collapsed .chat{grid-template-columns:34px;justify-content:center;padding:7px 4px}.chat[aria-current="true"]{background:#e8f3ed;color:var(--green-dark)}.chat[aria-current="true"]:before{position:absolute;left:0;width:3px;height:24px;border-radius:0 3px 3px 0;background:var(--green);content:""}.conversation{display:flex;flex-direction:column;min-height:0}.conversation-head{display:flex;justify-content:space-between;gap:16px;align-items:center;padding-bottom:18px;border-bottom:1px solid var(--line)}.messages{display:flex;flex-direction:column;gap:12px;padding:20px 0;flex:1;min-height:220px}.message{max-width:65%;background:#f1f5f2;border-radius:16px;padding:12px;overflow-wrap:anywhere}.message.own{margin-left:auto;background:#dff1e6}.message p{margin:6px 0;line-height:1.45}.message-actions{display:flex;gap:4px;flex-wrap:wrap}.message button{border:0;background:transparent;color:var(--green);padding:8px;min-width:44px;min-height:44px}.load-history{align-self:center}.composer{border-top:1px solid var(--line);padding-top:16px}.composer textarea{resize:vertical}.composer-actions{justify-content:flex-end;margin-top:10px}.composer>p{font-size:13px;color:#68786f;margin-top:8px}.reply-context{border-left:3px solid var(--green);padding:8px 12px;margin-bottom:10px;background:var(--soft)}.settings-content{display:flex;flex-direction:column;gap:18px;overflow:auto;padding:4px 24px 24px}.settings-content>p,.settings-content section>p{margin-top:8px;line-height:1.5;color:#5f7067}.settings-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:24px 24px 16px;border-bottom:1px solid var(--line)}.context-card{border-top:1px solid var(--line);padding-top:18px}.context-card dl{display:grid;grid-template-columns:auto 1fr;gap:8px 12px}.context-card dt{color:#68786f}.context-card dd{margin:0;text-align:right}.visibility-row{display:flex;align-items:center;gap:10px;min-height:44px}.visibility-row input{width:44px;height:44px;margin:0}.visibility-row label{min-width:0;overflow-wrap:anywhere}.empty-state,.neutral{display:grid;place-content:center;text-align:center;gap:10px;padding:32px}.neutral{min-height:calc(100vh - 76px);background:#fff}.empty-state p,.neutral p{color:#68786f}dialog{width:min(540px,calc(100% - 32px));border:0;border-radius:20px;padding:0;box-shadow:0 24px 80px rgba(0,0,0,.25)}dialog::backdrop{background:rgba(16,28,23,.5)}.settings-panel{width:min(460px,calc(100% - 24px));max-height:calc(100vh - 24px)}.settings-drawer{display:flex;flex-direction:column;max-height:calc(100vh - 24px)}.confirm-card{padding:24px;display:grid;gap:16px}.confirm-card dl{display:grid;grid-template-columns:auto 1fr;gap:8px 16px}.confirm-card dt{color:#68786f}.confirm-card dd{margin:0}.confirm-card blockquote{margin:0;padding:14px;border-radius:12px;background:var(--soft);overflow-wrap:anywhere}.dialog-actions{justify-content:flex-end}#toast{flex:1 1 0;min-width:0;max-height:44px;overflow:auto;overflow-wrap:anywhere;white-space:normal;padding:2px 6px;font-size:11px;line-height:14px;color:#4c738b}#toast[data-error=true]{color:#9f2f36}#toast:empty{display:none}[hidden]{display:none!important}@media(max-width:900px){.workspace-layout{grid-template-columns:260px minmax(0,1fr)}.auth-options{grid-template-columns:1fr}}@media(max-width:760px){.chat{grid-template-columns:32px minmax(0,1fr);min-height:52px}.chat-avatar-wrap,.chat-avatar{width:32px;height:32px}.settings-head{padding:18px}.settings-content{padding:4px 18px 18px}.app-header{align-items:flex-start}.workspace-layout{display:block}.workspace-layout>*{border-bottom:1px solid var(--line)}.message{max-width:65%}.conversation-head{align-items:flex-start;flex-wrap:wrap}.auth-layout{padding:16px}.auth-card{padding:22px}.header-actions{justify-content:flex-end}.dialog-actions>*{flex:1}}

/* Owner-approved refined compact R2TG composition: r2tg-ui-approved-compact-r2-20260921 */
:root{--line:#e5eae7;--green:#176044;--green-dark:#14513b;--soft:#f8faf9;--rail:#f8faf9;--out:#f1f9fd;--focus:#165fdd}
.app-header{height:52px;min-height:52px;padding:4px 10px 4px 14px;background:#fff;border-bottom:1px solid var(--line);gap:10px}
.brand{gap:8px;flex-wrap:nowrap}.brand .eyebrow{display:none}.brand-mark{width:28px;height:28px;border-radius:9px;font-size:11px}.brand h1{font-size:14px;letter-spacing:-.01em}
.header-actions{gap:4px;flex-wrap:nowrap}.safe{padding:4px 8px;font-size:10px}.icon-button{border-radius:11px}.icon-button .glyph{font-size:16px}
#chat-drawer-toggle{display:grid;flex:0 0 44px}
.auth-layout,.neutral{min-height:calc(100vh - 52px)}
.workspace-layout{grid-template-columns:260px minmax(360px,1fr);gap:0;min-height:calc(100vh - 52px);background:#fff}.workspace-layout.rail-collapsed{grid-template-columns:72px minmax(360px,1fr)}.workspace-layout>*{min-width:0;padding:0;background:#fff}
.chat-rail{position:relative;border-right:1px solid var(--line);background:#f8faf9}.account-card{display:none}.section-title{min-height:40px;margin:0;padding:0 8px 0 12px;align-items:center;color:#1d2521;font-size:12px;font-weight:800;letter-spacing:0;text-transform:none}.section-title-actions{display:flex;min-width:0;align-items:center;gap:4px}.section-title #chat-count{display:inline-flex;min-width:0;align-items:center;color:#52635a;font-size:10px;font-weight:600;line-height:1.2;white-space:nowrap}.chat-tools-toggle{display:grid;place-items:center;width:36px;height:36px;min-width:36px;min-height:36px;padding:0;border:0;border-radius:10px;background:transparent;color:#71808a}.chat-tools-toggle:hover,.chat-tools-toggle[aria-expanded="true"]{background:#eaf4fb;color:var(--telegram-blue)}.chat-tools-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.rail-toggle{flex:0 0 44px}
.search-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.chat-rail #chat-search{width:calc(100% - 24px);min-height:44px;margin:0 12px 8px;padding:7px 9px;border-color:#e1e7e3;border-radius:9px;color:#52635a;font-size:11px}
#chat-list{display:grid;gap:2px;padding:0 6px}.chat-row{margin:0}.chat{grid-template-columns:34px minmax(0,1fr);gap:8px;min-height:54px;padding:6px;border-radius:10px;color:#1d2521}.chat:hover{background:#f0f5f2}.chat-main{min-width:0}.chat-main span{font-size:12px;font-weight:800}.chat-avatar-wrap,.chat-avatar{width:34px;height:34px}.chat-avatar{border-radius:11px;background:#58776a;font-size:11px}.chat-type{width:15px;height:15px;right:-4px;bottom:-3px;border-color:var(--rail);font-size:9px}.chat[aria-current="true"]{background:#e8f5ed}.chat[aria-current="true"]:before{height:24px;background:var(--green)}
.chat-title-line{display:flex!important;align-items:center;gap:6px}.chat-title-line strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-title-line time{margin-left:auto;color:#81929c;font-size:10px;font-weight:400;flex:none}
.chat-rail.collapsed{padding:0}.chat-rail.collapsed .section-title{justify-content:center;padding:4px}.chat-rail.collapsed .chat-tools-toggle,.chat-rail.collapsed .chat-tools{display:none}.chat-rail.collapsed #chat-list{gap:8px;padding:0 14px}.chat-rail.collapsed .chat{grid-template-columns:34px;min-height:48px;padding:5px}.chat-rail.collapsed .chat[aria-current="true"]:before{left:-8px}.chat-rail.collapsed .chat-type{display:grid}
.conversation{min-width:0;min-height:0}.conversation-head{min-height:58px;padding:7px 12px 7px 16px;border-bottom:1px solid var(--line)}.conversation-head h2{font-size:15px;letter-spacing:-.01em}.conversation-meta{display:block;margin-top:2px;color:#69766f;font-size:10px;text-transform:none;letter-spacing:0}.head-actions{gap:2px;flex-wrap:nowrap}
#focus-actions-toggle{margin-right:6px}
.chat-activity{display:block;margin-top:2px;color:var(--telegram);font-size:11px;font-weight:600}.chat-activity[hidden]{display:none}
.messages{min-height:350px;gap:6px;padding:14px 16px;background:#fbfcfb;overflow:auto}.message{position:relative;max-width:65%;width:fit-content;align-self:flex-start;padding:7px 9px;border:1px solid #e4eae6;border-radius:12px 12px 12px 4px;background:#fff;box-shadow:0 1px 1px #15211708;font-size:14px}.message.own{max-width:88.4%;align-self:flex-end;margin-left:0;border-color:#dcecf4;border-radius:12px 12px 4px 12px;background:var(--out)}.message strong{color:#496456;font-size:10px}.message p{margin:2px 0 0;color:#29352e;font-size:14px;line-height:1.35}.message small{color:#87938c;font-size:10px}.message-actions{position:absolute;right:2px;bottom:-42px;z-index:2;opacity:0;transition:opacity .15s}.message:hover .message-actions,.message:focus-within .message-actions{opacity:1}.message button{border-radius:9px;background:#fff;box-shadow:0 1px 4px #15211718}.load-history{min-height:44px;margin:2px auto;border:0;background:transparent;font-size:11px}
.composer{display:flex;align-items:flex-end;flex-wrap:wrap;gap:8px;padding:9px 12px;border-top:1px solid var(--line)}.sr-only{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%)!important}.composer textarea{flex:1 1 0;min-width:0;min-height:44px;max-height:min(40vh,360px);padding:9px;border-color:var(--line);border-radius:9px;background:#fbfcfb;font-size:11px;resize:vertical;overflow:auto}.composer-actions{flex:0 0 auto;gap:4px;margin:0}.reply-context{flex:1 0 100%;margin:0;padding:6px 9px;border-radius:0 5px 5px 0;font-size:10px}.session-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
@media(max-width:900px){.workspace-layout{grid-template-columns:260px minmax(0,1fr)}}
@media(max-width:760px){body.chat-drawer-open{overflow:hidden}.app-header{height:52px;min-height:52px;align-items:center;padding:4px 8px}.brand{gap:4px}.safe{white-space:nowrap}.workspace-layout,.workspace-layout.rail-collapsed{display:block;min-width:0}.workspace-layout>*{border-bottom:1px solid var(--line)}#chat-drawer-toggle{display:grid;flex:0 0 44px}.chat-rail,.chat-rail.collapsed{position:fixed;z-index:21;top:52px;bottom:0;left:0;width:min(224px,calc(100vw - 48px));padding:0;border-right:1px solid var(--line);overflow-y:auto;visibility:hidden;transform:translateX(-100%);transition:transform .18s ease}.chat-rail.drawer-open{visibility:visible;transform:translateX(0)}#chat-drawer-backdrop{position:fixed;z-index:20;inset:52px 0 0;width:auto;height:auto;min-width:0;min-height:0;padding:0;border:0;border-radius:0;background:rgba(16,28,23,.42)}.chat-rail.collapsed .section-title{justify-content:space-between;padding:4px 8px 4px 12px}.chat-rail.collapsed.drawer-open #chat-count{display:inline-flex}.chat-rail.collapsed #chat-search,.chat-rail.collapsed .rail-copy,.chat-rail.collapsed .chat-main{display:block}.chat-rail.collapsed #chat-list{gap:2px;padding:0 6px}.chat-rail.collapsed .chat{grid-template-columns:32px minmax(0,1fr);justify-content:stretch;min-height:52px;padding:5px}.chat-rail.collapsed .chat[aria-current="true"]:before{left:0}.rail-toggle{display:none}.section-title{min-height:46px}.chat-rail #chat-search{margin-bottom:8px}#chat-list{grid-template-columns:1fr;gap:4px;padding:0 8px 8px}.chat{grid-template-columns:32px minmax(0,1fr);gap:6px;min-height:52px;padding:5px}.chat-avatar-wrap,.chat-avatar{width:32px;height:32px}.conversation-head{min-height:54px;padding:6px 8px 6px 12px}.messages{min-height:282px;gap:6px;padding:12px}.message{max-width:65%;padding:7px 9px}.message.own{max-width:95%}.composer{padding:8px 10px}.settings-head{padding:18px}.settings-content{padding:4px 18px 18px}.auth-layout{padding:16px}.auth-card{padding:22px}.dialog-actions>*{flex:1}}
.message-meta{display:flex;align-items:baseline;gap:7px;color:#496456;font-size:10px;font-weight:800}.message-meta time{color:#87938c;font-weight:600}.message-receipt{display:inline-flex;min-width:12px;align-items:center;justify-content:flex-end;font-size:12px;font-weight:800;line-height:1;letter-spacing:-3px}.message-receipt.accepted{color:#7d8983}.message-receipt.read{color:#258fc4}
.message-date-separator{align-self:center;margin:5px 0;padding:4px 9px;border-radius:999px;background:#eef3f6;color:#71818d;font-size:10px;font-weight:600;line-height:1.2}

/* Full-height workspace and scalable chat visibility controls. */
html,body{height:100%;overflow:hidden}
body{min-height:0;display:flex;flex-direction:column}
/* Login content can grow beyond a short viewport; only the connected workspace is viewport-locked. */
html:has(#auth-view:not([hidden])),body:has(#auth-view:not([hidden])){height:auto;min-height:100%;overflow-y:auto}
body:has(#auth-view:not([hidden])){display:block}
.app-header{flex:0 0 auto}
.workspace-layout{height:auto;min-height:0;overflow:hidden;flex:1 1 0}
.workspace-layout>*{min-height:0}
.chat-rail{display:flex;flex-direction:column;overflow:hidden}
#chat-list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;align-content:start;grid-auto-rows:min-content}
@media(min-width:761px){.chat-rail.collapsed #chat-list{padding:0 4px}.chat-rail.collapsed .chat-row{min-width:0;width:100%}.chat-rail.collapsed .chat{width:100%;min-width:0;justify-content:center}}
.conversation{height:100%;overflow:hidden}
.messages-shell{position:relative;display:flex;flex:1;order:1;min-height:0;flex-direction:column}.messages{min-height:0;overflow-y:auto;overscroll-behavior:contain}
.load-history{flex:none;order:0}.messages-shell .messages{order:1}.composer{flex:none;order:2}
.visibility-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.visibility-heading p{margin-top:5px}.visibility-heading button{flex:none;min-height:36px;padding:6px 9px;font-size:11px}
.visibility-search{display:block;margin-top:12px}.visibility-search input{width:100%;min-height:36px;padding:7px 9px;border:1px solid var(--line);border-radius:9px}
.visibility-count{margin:7px 0;color:#68786f;font-size:10px}
#visibility-list{display:grid;max-height:320px;overflow-y:auto;overscroll-behavior:contain;border-block:1px solid var(--line)}
.visibility-row{display:flex;align-items:center;gap:8px;min-height:34px;padding:4px 2px;border-bottom:1px solid #edf1ee;cursor:pointer}.visibility-row:last-child{border-bottom:0}.visibility-row:hover{background:#f4f7f5}.visibility-row input{width:18px;height:18px;min-width:18px;min-height:18px;margin:0}.visibility-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.visibility-empty{padding:12px;color:#68786f;font-size:12px}
.message button{width:24px;height:24px;min-width:24px;min-height:24px;padding:0;font-size:14px}

/* Compact settings keeps the available height for large chat lists. */
.settings-panel{width:min(440px,calc(100% - 24px));border:1px solid #e4edf3;border-radius:16px;background:#fbfcfd;color:#405768;box-shadow:0 20px 70px #263c5029}
.settings-panel::backdrop{background:#233c4b38;backdrop-filter:blur(3px)}
.settings-drawer{height:min(650px,calc(100vh - 24px));min-height:0}
.settings-head{padding:14px 18px 12px;border-bottom:1px solid #e8eef3;align-items:center}
.settings-head h2{font-size:15px;font-weight:600;letter-spacing:-.3px;color:#263c4b}.settings-head .eyebrow{font-size:9px;letter-spacing:1.5px;color:#90a0ad;margin-bottom:5px}
#close-settings{display:grid;place-items:center;width:32px;height:32px;min-width:32px;min-height:32px;padding:7px;border:0;background:transparent;color:#7f95a4;border-radius:8px}#close-settings:hover{background:#eaf5fc;color:#247dad}#close-settings svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
.settings-content{min-height:0;gap:12px;overflow:hidden;padding:14px 16px}
.context-card{padding:12px;border:1px solid #e6edf2;border-radius:12px;background:#fff}.context-card h3{font-size:13px;font-weight:600;letter-spacing:-.2px;color:#405768}.context-card dl{gap:6px 10px;margin:10px 0;font-size:11px;line-height:1.5}.context-card dt{color:#8795a0}.context-card dd{color:#4d6373}
.settings-panel .session-actions button,.settings-panel #refresh-chats{min-height:30px;min-width:0;padding:5px 9px;border:0;border-radius:7px;background:#eff6fa;color:#438aae;font-size:11px}.settings-panel .session-actions button:hover,.settings-panel #refresh-chats:hover{background:#e4f1fa}.settings-panel #revoke{color:#a96670;background:#fcf5f6}
.settings-panel .visibility-search input{font-size:12px;border-color:#e3eaf0;border-radius:8px;background:#fcfdfe;color:#405768}.settings-panel .visibility-heading p{color:#8795a0;font-size:10px}.settings-panel .visibility-row{border-color:#edf2f6;color:#4d6373}.settings-panel .visibility-row:hover{background:#f1f8fc}.settings-panel .visibility-row input{accent-color:#53a8da}.settings-panel .visibility-count{color:#8a9da9}
.session-actions{margin-top:8px}
.settings-header-actions.session-actions{margin:0;gap:4px;align-items:center}
.connection-details{flex:none}.connection-details summary{display:flex;align-items:center;justify-content:space-between;list-style:none;cursor:pointer;font-size:13px;font-weight:600;color:#405768}.connection-details summary::-webkit-details-marker{display:none}.connection-details summary::after{content:'⌄';color:#90a0ad}.connection-details[open] summary::after{transform:rotate(180deg)}
.crm-settings-section{flex:none}.crm-connection-control{display:flex;align-items:center;justify-content:space-between;gap:12px}.crm-connection-control h3{margin:0}.crm-connection-control p{margin:5px 0 0;font-size:11px;line-height:1.4;color:#738897}.crm-switch-control{position:relative;display:block;flex:none;width:112px;height:36px;cursor:pointer}.crm-switch-control input{position:absolute;z-index:1;inset:0;width:100%;height:100%;min-width:0;min-height:0;margin:0;opacity:0;cursor:pointer}.crm-switch-track{position:relative;display:grid;grid-template-columns:1fr 1fr;align-items:center;height:100%;padding:3px;border:1px solid #c4d6e2;border-radius:7px;background:#edf3f7;color:#587184;font-size:12px;font-weight:700;text-align:center}.crm-switch-track::before{content:'';position:absolute;top:3px;bottom:3px;left:3px;width:calc(50% - 3px);border-radius:4px;background:#657d8c;transform:translateX(100%);transition:transform .15s ease,background .15s ease}.crm-switch-track>span{position:relative}.crm-switch-off{color:#fff}.crm-switch-control input:checked+.crm-switch-track::before{transform:translateX(0);background:#229ed9}.crm-switch-control input:checked+.crm-switch-track .crm-switch-on{color:#fff}.crm-switch-control input:checked+.crm-switch-track .crm-switch-off{color:#587184}.crm-switch-control input:focus-visible+.crm-switch-track{outline:2px solid #165fdd;outline-offset:3px}.crm-switch-control input:disabled{cursor:default}.crm-switch-control input:disabled+.crm-switch-track{opacity:.5}.chat-filter[hidden]{display:none!important}
.settings-content>.context-card:last-child{display:flex;flex:1;min-height:0;flex-direction:column}
.visibility-heading p{font-size:11px;line-height:1.35}
#visibility-list{flex:1;max-height:none}
.composer{position:relative;padding-top:18px}
.attachment-status{width:100%;min-width:0;margin-bottom:6px;padding:8px 10px;border:1px solid #e6bcc0;border-radius:8px;background:#fff4f4;color:#8d252d;font-size:13px;line-height:18px;overflow-wrap:anywhere}.attachment-preview{flex:1 0 100%;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 5px 4px 9px;border:1px solid #cfe5f2;border-radius:8px;background:#f1f9fd;color:#315f79;font-size:12px}.attachment-copy{display:grid;flex:1;min-width:0;gap:1px}.attachment-copy span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.attachment-copy #attachment-size{color:#5f7481;font-size:11px;line-height:14px}.attachment-preview button{flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-radius:8px;background:transparent;color:#4c738b}.attachment-preview button:hover,.attachment-preview button:focus-visible{background:#dceef8}.composer-actions #attach-photo{color:#229ed9}
[data-r2tg-theme="tg-dark"] .attachment-status{border-color:#71454a;background:#3a2427;color:#ffb3b7}[data-r2tg-theme="tg-dark"] .attachment-preview button:hover,[data-r2tg-theme="tg-dark"] .attachment-preview button:focus-visible{background:#ffffff14}
#composer-resize{position:absolute;left:50%;top:0;transform:translateX(-50%);width:48px;height:16px;display:grid;place-items:center;border-radius:6px;cursor:ns-resize;touch-action:none;user-select:none;color:#bdcfdb}
#composer-resize span{width:24px;height:4px;border-radius:4px;background:currentColor}#composer-resize:hover,#composer-resize:focus-visible{color:#53a8da;background:#edf7fd}#composer-resize:focus-visible{outline:2px solid #53a8da;outline-offset:1px}

/* Telegram identity and interaction palette. */
:root{--telegram:#229ed9;--telegram-dark:#1677a7;--telegram-soft:#e8f6fc;--green:var(--telegram);--green-dark:var(--telegram-dark);--out:#f1f9fd;--focus:#229ed9}
.brand-mark,.primary{background:var(--telegram);border-color:var(--telegram)}
.safe{background:var(--telegram-soft);color:var(--telegram-dark)}
.chat-avatar{background:#2189bd}.chat-type{width:17px;height:17px;color:#1677a7}.chat-type svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.chat[aria-current="true"]{background:var(--telegram-soft);color:var(--telegram-dark)}
.chat[aria-current="true"]:before{background:var(--telegram)}
.chat-avatar-wrap{border-radius:11px}.chat-avatar-photo{position:absolute;z-index:1;inset:0;width:100%;height:100%;border-radius:inherit;object-fit:cover;background:#eef4f7;opacity:0}.chat-avatar-photo.loaded{opacity:1}
.chat-avatar-wrap.compact-avatar,.compact-avatar .chat-avatar{width:24px;height:24px;border-radius:8px;flex:none}.compact-avatar .chat-avatar{font-size:8px}.visibility-row{gap:7px}
.message{position:relative;padding-right:60px}.message-actions{position:absolute;right:5px;bottom:5px;display:flex;align-items:flex-end;gap:2px}.message button{color:var(--telegram)}
.message-reaction{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;margin-top:5px;padding:0 6px;border:1px solid #c9dbe5;border-radius:999px;background:#fff;color:var(--telegram-dark);font-size:13px;line-height:1}.message [data-react][aria-pressed="true"]{background:#fff4cf;color:#8a5a00;opacity:1}
.message.own{background:var(--out)}
.message-menu{position:relative}.message-menu summary{display:grid;place-items:center;width:24px;height:24px;border-radius:9px;background:#fff;color:var(--telegram);cursor:pointer;list-style:none;box-shadow:0 1px 4px #15211718}.message-menu summary::-webkit-details-marker{display:none}.message-menu-list{display:none}.message-menu[open]>.message-menu-list{position:absolute;z-index:3;right:0;bottom:28px;display:grid;min-width:112px;padding:4px;border:1px solid #dbe6ec;border-radius:10px;background:#fff;box-shadow:0 8px 24px #1532451c}.message-menu[open]>.message-menu-list button{position:static;width:100%;height:auto;min-width:0;min-height:30px;padding:5px 8px;text-align:left;color:#2c607c;font-size:11px;white-space:nowrap}.message-menu[open]>.message-menu-list button[data-unsend]{color:var(--danger)}.message-action-dialog textarea,.message-action-dialog select{width:100%;border:1px solid #cfdae1;border-radius:12px;padding:10px 12px}.reply-context{position:relative;padding-right:34px}.reply-context #cancel-reply{position:absolute;top:3px;right:3px;width:24px;height:24px;min-width:24px;min-height:24px;padding:0;border:0;background:transparent;box-shadow:none;font-size:18px;line-height:1}.conversation-meta{display:none}
.message.media-message{width:min(546px,65%);padding-right:12px;padding-bottom:38px}.message.own.media-message{width:min(676px,88.4%)}
.message a{color:var(--telegram-dark);text-decoration-thickness:1px;text-underline-offset:2px}.message-media-frame{position:relative;display:grid;place-items:center;width:min(546px,100%);aspect-ratio:16/9;max-height:320px;margin:6px 0;overflow:hidden;border-radius:12px;background:#dce6ea}.message-media-status{position:absolute;color:#617480;font-size:11px}.message-media-frame[data-state="loaded"] .message-media-status{display:none}.message-media-frame[data-state="error"]{min-height:88px;aspect-ratio:auto}.message-media{position:relative;z-index:1;display:block;width:100%;height:100%;max-height:320px;border-radius:12px;object-fit:contain;background:transparent;opacity:0}.message-media.media-loaded{opacity:1}.message video{width:100%}.message .video-load{position:absolute;z-index:2;display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;border-radius:999px;background:#ffffffdf;color:var(--telegram-dark);box-shadow:0 4px 16px #17465f33}
.message .message-image-open{min-width:44px;min-height:44px;height:auto;padding:0;border:0;color:inherit;cursor:zoom-in}.message-image-open:focus-visible{outline:3px solid var(--green);outline-offset:2px}.image-viewer-dialog{width:calc(100% - 32px);max-width:1100px;height:calc(100% - 32px);max-height:900px;background:#fff;color:#17221d;overflow:hidden}.image-viewer-shell{display:flex;flex-direction:column;height:100%;min-height:0}.image-viewer-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--line)}.image-viewer-head>div:first-child{flex:1;min-width:0}.image-viewer-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.image-viewer-actions{display:flex;flex:none;align-items:center;gap:10px}.image-viewer-stage{position:relative;display:grid;place-items:center;flex:1;min-height:0;padding:16px;background:#101513}.image-viewer-stage>span{color:#fff}.image-viewer-stage[data-state="error"]>span{color:#ffd8d8}.image-viewer-stage img{display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain}.image-viewer-dialog::backdrop{background:rgba(6,12,9,.78)}@media(max-width:600px){.image-viewer-dialog{width:100%;height:100%;max-width:none;max-height:none;border-radius:0}.image-viewer-head{align-items:flex-start;padding:10px 12px}.image-viewer-actions{gap:8px}.image-viewer-stage{padding:8px}}
.message-links{display:flex;flex-wrap:wrap;gap:4px 8px;margin-top:5px}.message-links a{font-size:11px;font-weight:700}
.message-file-name{display:block;max-width:100%;margin:2px 0 5px;overflow:hidden;color:inherit;font-size:11px;font-weight:700;text-overflow:ellipsis;white-space:nowrap}
.message-reply-quote{margin:5px 0 4px;padding:5px 7px;border-left:2px solid var(--telegram);border-radius:4px;background:#ffffff99;color:#53646d;font-size:10px;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.external-link-url{max-height:180px;overflow:auto;overflow-wrap:anywhere;padding:12px;border-radius:10px;background:var(--soft);font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:1.45}.link-button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 16px;border-radius:12px;text-decoration:none}
.settings-panel .session-actions button,.settings-panel #refresh-chats,.settings-panel #close-settings,.connection-details summary{min-height:44px;min-width:44px}
.composer{padding-top:20px}
#composer-resize{height:44px;top:-24px}
#composer-resize:hover,#composer-resize:focus-visible{background:transparent;outline:0}
#composer-resize:focus-visible span{outline:2px solid #53a8da;outline-offset:5px}
.messages{padding-bottom:28px}
#chat-drawer-toggle svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.conversation-head{flex-wrap:nowrap}
.conversation-head>div:first-child{flex:1 1 auto;min-width:0}
.conversation-head .head-actions{flex:0 0 auto}
.conversation-head h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Notices share the title row and leave every menu control available. */
.app-header .brand{flex:1;min-width:0}.app-header .brand-mark,.app-header .brand-title,.app-header .header-actions{flex-shrink:0}
.app-header .brand-title h1{display:flex;align-items:baseline;gap:7px;white-space:nowrap}.app-header .build-version{font-size:11px;font-weight:500;letter-spacing:0;color:#71818b;font-variant-numeric:tabular-nums}
.app-header:has(.build-update:not([hidden])){height:auto}.build-update{display:flex;flex:1 1 320px;min-width:220px;max-width:560px;align-items:center;gap:9px;padding:4px 7px;border:1px solid #cfe4f0;border-radius:9px;background:#f4fbff;color:#315f79}.build-update-copy{display:grid;min-width:0;gap:1px}.build-update-copy strong,.build-update-copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.build-update-copy strong{font-size:11px;line-height:14px}.build-update-copy span{color:#678092;font-size:10px;line-height:12px}.build-update-progress{flex:1 1 88px;min-width:64px;height:5px;overflow:hidden;border-radius:999px;background:#d8eaf4}.build-update-progress>span{display:block;height:100%;border-radius:inherit;background:#229ed9;transition:width .16s ease}.build-update button{flex:0 0 auto;min-width:68px;min-height:44px;padding:5px 9px;border-radius:7px;border-color:#b8d8e9;background:#fff;color:#247dad;font-size:11px;font-weight:700}.build-update[data-state="failed"]{border-color:#e3c4c8;background:#fff7f7;color:#8d3941}.build-update[data-state="failed"] .build-update-copy span{color:#9b676c}.build-update[data-state="failed"] button{border-color:#dfc2c5;color:#923d45}
[data-r2tg-theme="tg-dark"] .build-update{border-color:#365867;background:#182a32;color:#d8edf7}[data-r2tg-theme="tg-dark"] .build-update-copy span{color:#9db8c5}[data-r2tg-theme="tg-dark"] .build-update-progress{background:#314955}[data-r2tg-theme="tg-dark"] .build-update button{border-color:#456876;background:#203842;color:#c8e8f6}[data-r2tg-theme="tg-dark"] .build-update[data-state="failed"]{border-color:#74474c;background:#342326;color:#ffd9dc}[data-r2tg-theme="tg-dark"] .build-update[data-state="failed"] .build-update-copy span{color:#d8a7ab}[data-r2tg-theme="tg-dark"] .build-update[data-state="failed"] button{border-color:#805158;background:#422a2e;color:#ffd4d7}
@media(max-width:760px){
  .app-header #provider-mode-label,.app-header .brand-title .eyebrow{display:none}
  .app-header .brand-mark{width:32px;height:32px;border-radius:9px;font-size:11px}
  .app-header .brand-title h1{flex-direction:column;align-items:flex-start;gap:0;font-size:16px;line-height:1.05}
  .app-header .build-version{font-size:11px;line-height:1.2}
  .app-header:has(.build-update:not([hidden])){height:auto;min-height:52px;align-items:flex-start}.app-header:has(.build-update:not([hidden])) .brand{flex-wrap:wrap}.app-header .build-update{order:4;flex-basis:100%;max-width:none}.app-header .build-update-progress{min-width:54px}.app-header .build-update-copy{flex:1 1 150px}.app-header .build-update-copy strong{overflow:visible;white-space:normal}
}

/* Owner-approved Q1 shell: compact filters, truthful chat signals and chat-local settings. */
.chat-filters{display:flex;align-items:center;gap:8px;padding:0 12px 4px;white-space:nowrap;overflow:hidden}.chat-filters label{min-width:0}.chat-filters select{width:auto;max-width:76px;min-width:0;min-height:44px;padding:4px 17px 4px 0;border:0;background-color:transparent;color:#71808a;font-size:10px;cursor:pointer;text-overflow:ellipsis}.chat-filters select:hover,.chat-filters select:focus-visible{color:var(--telegram-dark)}
.chat{grid-template-columns:34px minmax(0,1fr) auto auto}.chat-rail.collapsed .chat-filters,.chat-rail.collapsed .chat-unread{display:none}.chat-title-row{display:flex;align-items:center;min-width:0;gap:2px}.chat-title-row h2{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-settings-button{flex:0 0 44px;color:#8095a3}
.chat-type{right:-5px;bottom:-4px;width:18px;height:18px}.chat-type svg{width:14px;height:14px}.chat-availability{position:absolute;z-index:3;top:-2px;right:-2px;width:8px;height:8px;border:2px solid var(--rail,#fff);border-radius:50%;box-sizing:content-box}.chat-availability.availability-personal{background:#3390EC}.chat-availability.availability-unavailable{background:#8E8E93}.chat-availability.availability-bot{background:#F2C94C}.chat-unread{display:grid;place-items:center;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--telegram);color:#fff;font-size:9px;font-weight:700}.chat-list-empty{padding:12px;color:#7c8c96;font-size:11px}
.chat-settings-dialog{width:min(420px,calc(100% - 24px));max-height:calc(100vh - 24px);overflow:hidden;border:1px solid #dce8ef;border-radius:16px;background:#fbfcfd;color:#405768}.chat-settings-dialog::backdrop{background:#233c4b38;backdrop-filter:blur(3px)}.chat-settings-shell{display:flex;max-height:calc(100vh - 26px);flex-direction:column}.chat-settings-head,.chat-settings-footer{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;border-bottom:1px solid #e7eef3}.chat-settings-head h2{font-size:15px}.chat-settings-body{display:grid;gap:9px;min-height:0;padding:12px 14px;overflow-y:auto}.settings-chat{display:flex;align-items:center;gap:9px;padding:2px}.settings-chat>div{display:grid;min-width:0}.settings-chat strong,.settings-chat small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-chat small{color:#8795a0;font-size:10px}.settings-chat-avatar{display:grid;place-items:center;width:32px;height:32px;flex:0 0 32px;border-radius:10px;background:var(--telegram);color:#fff;font-size:10px;font-weight:700}.settings-section{display:grid;gap:8px;padding:11px;border:1px solid #e6edf2;border-radius:11px;background:#fff}.settings-section h3,.settings-section summary{margin:0;color:#405768;font-size:11px;font-weight:700}.settings-section label{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;color:#71828e;font-size:10px}.settings-section select{width:150px;min-height:36px;padding:5px 8px;border:1px solid #e3eaf0;border-radius:8px;background:#fcfdfe;color:#526877;font-size:11px}.settings-section select:disabled{opacity:1;color:#7c8d98}.settings-section .toggle-row{grid-template-columns:minmax(0,1fr) auto}.settings-section .toggle-row span{display:grid;gap:2px}.settings-section .toggle-row small,.settings-status-row small,.settings-future p{color:#8a9aa5;font-size:10px;line-height:1.4}.settings-section input[type=checkbox]{width:18px;height:18px;min-width:18px;min-height:18px;accent-color:var(--telegram)}.settings-status-row{display:flex;align-items:center;justify-content:space-between;gap:9px}.settings-status-row span{display:grid;gap:2px}.settings-section dl{display:grid;grid-template-columns:auto 1fr;gap:5px 10px;margin:0;font-size:10px}.settings-section dt{color:#8a9aa5}.settings-section dd{margin:0;text-align:right;color:#526877}.settings-future summary{display:flex;justify-content:space-between;cursor:pointer}.chat-settings-footer{justify-content:flex-end;border-top:1px solid #e7eef3;border-bottom:0}.chat-settings-footer button{min-height:36px;padding:6px 11px;font-size:11px}
.settings-participants-list{display:grid;gap:4px;max-height:168px;overflow-y:auto;list-style:none;margin:0;padding:0}.settings-participants-list li{display:flex;justify-content:space-between;gap:8px;padding:5px 7px;border-radius:7px;background:var(--soft);color:inherit;font-size:11px}.settings-participants-list small{color:#8a9aa5}
.settings-bot-picker,.settings-bot-preview{display:grid;gap:7px;padding:10px;border:1px solid #b8ddef;border-radius:9px;background:#f1f9fd}.settings-bot-picker label{display:grid;grid-template-columns:minmax(0,1fr) auto}.settings-bot-picker>small,.settings-bot-preview>small{color:#71828e;font-size:10px;line-height:1.4}.settings-bot-picker>div,.settings-bot-preview>div{display:flex;justify-content:flex-end;gap:6px}.settings-bot-picker button,.settings-bot-preview button{min-height:34px;padding:5px 10px;font-size:10px}.settings-bot-preview p{margin:0;color:#405768;font-size:11px;line-height:1.45}#settings-bot-title.confirmed{color:#218b57}#auth-security-copy{margin-top:18px}
.settings-note{margin:0;color:#8a9aa5;font-size:10px;line-height:1.4}.settings-future-body{display:grid;gap:2px;padding-top:7px}.settings-future-body button{min-height:32px;padding:5px 0;border:0;border-top:1px solid #edf2f6;background:transparent;color:#71828e;text-align:left;font-size:10px}.settings-future-body button:disabled{opacity:1;cursor:default}
@media(max-width:760px){.chat-rail.collapsed .chat-filters{display:flex}.chat-rail.collapsed .chat-availability{display:block}.chat-rail.collapsed .chat-unread{display:grid}.chat{grid-template-columns:32px minmax(0,1fr) auto auto}}

.message-reaction-picker{display:grid;grid-template-columns:repeat(3,32px);gap:3px;padding:3px}.message-reaction-picker button{display:grid!important;place-items:center!important;min-width:32px!important;padding:4px!important;text-align:center!important}.message-reaction-picker button[data-reaction-emoji=remove]{grid-column:1/-1;width:100%!important;font-size:10px!important}.message-reaction.selected{border-color:#72bce5;background:#eaf7ff}

/* Approved Q1 composition: one persistent rail toggle and compact bubbles. */
.message{max-width:50%}
.message.own{max-width:48%}
.message.own.media-message{width:min(546px,48%)}
@media(max-width:760px){.message{max-width:50%}.message.own{max-width:60%}.message.own.media-message{width:min(546px,60%)}}
.topic-select{max-width:14rem;border:0;background:transparent;color:var(--muted);padding:.2rem 1.5rem .2rem .35rem;font:inherit;font-size:.82rem}.topic-select:hover,.topic-select:focus{background:var(--blue-soft);color:var(--blue);outline:none;border-radius:.55rem}

/* Designer2 Q1 pixel gate: accepted Blue spacing, typography and rail notice. */
:root{color:#314957;--line:#e5edf2}
.chat-rail{background:#f8fafb}
.messages{padding:20px 22px 24px}
.message p{font-size:14px;line-height:1.45;color:#344b59;white-space:pre-wrap}
.composer{padding:14px 14px 14px 18px}
.composer textarea{min-height:48px;padding:14px 12px;font-size:12px;line-height:18px}
.q1-notice{position:relative;display:flex;align-items:stretch;margin:0 8px 12px;border:1px solid #e2e5e7;border-radius:16px;background:#f3f3f4;color:#314957;overflow:hidden}
.q1-notice-content{display:grid;flex:1;gap:3px;min-width:0;min-height:0;padding:10px 8px 10px 12px;border:0;background:transparent;color:inherit;text-align:left}
.q1-notice-content strong{font-size:11px;line-height:1.25}.q1-notice-content>span{font-size:10px;line-height:1.35;color:#718391}
.q1-notice-close{display:grid;place-items:center;align-self:flex-start;width:32px;height:32px;min-width:32px;min-height:32px;margin:4px;padding:7px;border:0;border-radius:9px;background:transparent;color:#718391}
.q1-notice-close:hover{background:#e5e9eb}.q1-notice-close svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}
.chat-rail.collapsed .q1-notice{display:none}
.appearance-mode-toggle{border-top:1px solid var(--line)}
#composer-resize{top:-30px}
@media(max-width:760px){.messages{padding:17px 13px 20px}.composer{padding:11px 9px}#composer-resize{top:-33px}.chat-rail.collapsed.drawer-open .q1-notice{display:flex}}

/* Designer2 Q1 notice and Blue composer parity. */
.composer textarea{color:#435f70}
.q1-notice{min-height:65px}
.q1-notice-content{gap:3px;padding:9px 8px 9px 12px}
.q1-notice-content strong,.q1-notice-content>span{font-size:14px;line-height:21px}
.q1-notice-close{height:44px;min-height:44px;margin:9px 4px}

/* Accepted Q1 message hierarchy and icon-only Send control. */
#send-message{display:inline-flex;align-items:center;justify-content:center;width:44px;height:48px;min-width:44px;min-height:48px;flex:0 0 44px;padding:0;border-radius:8px}
#send-message svg{display:block;width:16px;height:16px;fill:currentColor;stroke:none}
#send-message .send-label{display:none}

/* Approved Q1 rail search and outlined composer action. */
.chat-tools{padding-top:2px}.search-wrap{position:relative;display:flex;align-items:center;margin:0 12px 8px}
.search-wrap>[data-chat-search-icon]{position:absolute;z-index:1;left:10px;display:flex;color:#9aaeba;pointer-events:none}
.search-wrap>[data-chat-search-icon] svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.chat-rail .search-wrap #chat-search{width:100%;margin:0;padding-left:32px}
.chat-rail.collapsed .search-wrap{display:none}
.filter-catalog-feedback{display:flex;align-items:center;gap:8px;padding:0 12px 8px;color:#71808a;font-size:11px;line-height:1.35}.filter-catalog-feedback[hidden]{display:none}.filter-catalog-feedback p{flex:1;min-width:0;margin:0}.filter-catalog-feedback button{flex:0 0 auto;min-width:44px;min-height:44px;padding:6px 10px}.filter-catalog-feedback button[aria-disabled="true"]{cursor:wait;opacity:.7}.chat-filters select:disabled{cursor:default;opacity:.7}.chat-filters select:focus-visible,.filter-catalog-feedback button:focus-visible,.chat-filter-empty button:focus-visible{outline:2px solid var(--telegram-blue);outline-offset:2px}.chat-filter-empty{display:grid;gap:7px;padding:16px 12px;color:#526877}.chat-filter-empty h3,.chat-filter-empty p{margin:0}.chat-filter-empty h3{font-size:13px}.chat-filter-empty p{font-size:11px;line-height:1.45}.chat-filter-empty button{justify-self:start;min-height:44px;padding:7px 12px}
#send-message svg{fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:760px){.chat-rail.collapsed .search-wrap{display:flex}.chat-rail.collapsed.drawer-open .chat-tools-toggle{display:grid}.chat-rail.collapsed.drawer-open .chat-tools:not([hidden]){display:block}}
.message{padding:8px 11px}
.message .message-sender{display:block;margin-bottom:4px;color:#7295a7;font-size:10px;font-weight:600}
.message.own .message-sender{color:#4b92b8}
.message-meta{justify-content:flex-end;margin-top:5px;padding-right:0;color:#92a8b4;font-size:9px;font-weight:400}
.message-meta time{color:inherit;font-weight:400}
.chat-title-action{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;min-width:28px;min-height:28px;border:0;border-radius:7px;background:transparent;color:#66879c;font-size:11px;font-weight:600;padding:3px 5px}.chat-title-action:hover{background:#eaf5fc;color:#247dad}.chat-copy-action{width:28px;padding:4px}.chat-copy-action svg{width:17px;height:17px}.chat-bot-action{white-space:nowrap;color:#2788bd}
.toast-action-notice{display:flex;align-items:center;gap:8px;min-width:0}.toast-action-notice>span{flex:1 1 auto;min-width:0}.toast-action-button{flex:0 0 auto;min-width:44px;min-height:44px;padding:6px 10px;border:1px solid currentColor;border-radius:8px;background:transparent;color:inherit;font-size:11px;font-weight:700}.toast-action-button:focus-visible{outline:2px solid #165fdd;outline-offset:1px}
.build-copy{display:inline-flex;vertical-align:middle;align-items:center;justify-content:center;width:26px;height:26px;min-width:26px;min-height:26px;margin-left:3px;padding:4px;border:0;border-radius:6px;background:transparent;color:#8095a3}.build-copy:hover{background:#eaf5fc;color:#247dad}.build-copy svg{width:16px;height:16px}
.telegram-account-about{white-space:pre-wrap;overflow-wrap:anywhere}.telegram-account-profile p{margin:8px 0}

/* Workspace-wide settings are reached from the R2 mark, separately from account settings. */
.app-header button.brand-mark{width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;background:transparent;color:inherit}
.app-header .brand-mark-face{width:28px;height:28px;display:grid;place-items:center;border-radius:9px;background:var(--telegram);color:#fff;font-size:11px;font-weight:800;line-height:1}
@media(max-width:760px){.app-header .brand-mark-face{width:32px;height:32px}}
.app-header .brand{position:relative}.app-header button.brand-mark{border:0;cursor:pointer;font:inherit;font-weight:800}.app-header button.brand-mark:focus-visible{outline:3px solid #165fdd;outline-offset:2px}.global-settings-menu{position:absolute;z-index:32;top:calc(100% + 12px);left:36px;display:grid;gap:6px;min-width:240px;padding:10px;border:1px solid #dce8ef;border-radius:12px;background:#fff;box-shadow:0 12px 32px #18394d24}.global-settings-menu[hidden]{display:none}.global-settings-menu span{padding:5px 8px;color:#7b91a1;font-size:11px;text-transform:uppercase;letter-spacing:.06em}.global-settings-menu button{width:100%;min-height:38px;padding:7px 9px;border:0;border-radius:8px;background:transparent;color:#405768;text-align:left;font-size:13px}.global-settings-menu button:hover,.global-settings-menu button:focus-visible{background:#eaf5fc;color:#247dad}
.global-bot-dialog{width:min(510px,calc(100% - 24px));max-height:calc(100vh - 24px);padding:0;border:1px solid #dce8ef;border-radius:16px;background:#fbfcfd;color:#405768}.global-bot-dialog::backdrop{background:#233c4b55}.global-bot-shell{display:flex;max-height:calc(100vh - 26px);flex-direction:column}.global-bot-shell>header{display:flex;justify-content:space-between;align-items:center;padding:17px 20px;border-bottom:1px solid #e7eef3}.global-bot-shell h2{font-size:19px}.global-bot-body{display:grid;gap:15px;overflow-y:auto;padding:20px}.global-bot-body>p{color:#718695;font-size:13px;line-height:1.45}.global-bot-body dl{display:grid;grid-template-columns:100px minmax(0,1fr);gap:9px;margin:0;padding:15px;border:1px solid #e6edf2;border-radius:11px;background:#fff;font-size:13px}.global-bot-body dt{color:#8194a0}.global-bot-body dd{margin:0;overflow-wrap:anywhere;font-weight:600}.global-bot-body label{display:grid;gap:6px;margin-bottom:11px;font-size:12px;font-weight:600}.global-bot-body input,.global-bot-body select{width:100%;padding:9px 11px;border:1px solid #dce8ef;border-radius:9px;background:#fff;color:#405768}.global-bot-actions{display:flex;flex-wrap:wrap;gap:8px}.global-bot-actions button{min-height:44px}.global-bot-confirm-panel{display:grid;gap:11px;padding:14px;border:1px solid #b6d9ed;border-radius:11px;background:#f1f9fd}.global-bot-confirm-panel p{font-size:13px;line-height:1.45}.global-bot-dialog [hidden]{display:none!important}
@media(max-width:760px){.global-settings-menu{left:2px;top:calc(100% + 7px)}.global-bot-body{padding:15px}.global-bot-body dl{grid-template-columns:80px minmax(0,1fr)}.global-bot-actions>*{flex:1}}
#saved-session-recovery{grid-column:1/-1}
#saved-session-recovery .primary,#saved-session-recovery .quiet{justify-self:start}

/* Bounded Unicode picker for the in-app composer. */
.composer-input{position:relative}#composer-emoji-toggle span{font-size:24px;line-height:1}.composer-emoji-picker{position:absolute;z-index:18;left:48px;bottom:calc(100% + 8px);width:300px;padding:8px;border:1px solid #cfe0eb;border-radius:14px;background:#fff;box-shadow:0 12px 30px #17384d33}.composer-emoji-grid{display:grid;grid-template-columns:repeat(6,44px);gap:4px}.composer-emoji-option{display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border-color:transparent;border-radius:10px;background:transparent;font-size:22px;line-height:1}.composer-emoji-option:hover,.composer-emoji-option:focus-visible{border-color:#b9d9eb;background:#e8f6fc}.composer-emoji-option:focus-visible{outline:3px solid #165fdd;outline-offset:-3px}@media(max-width:500px){.composer-emoji-picker{left:0;width:300px;max-width:calc(100vw - 24px)}}
.workspace-layout.shared-deal-view{grid-template-columns:minmax(0,1fr)}

/* TASK-107: the visible error owns its manual diagnostics copy control. */
.app-header.has-notice{height:auto;min-height:52px}.brand:has(#toast:not(:empty)){flex:1;min-width:0}#toast:has(.error-diagnostic-notice){max-height:52px}.error-diagnostic-notice{display:flex;align-items:center;gap:6px;min-width:0}.error-diagnostic-notice [data-error-message]{flex:1 1 120px;min-width:0;overflow-wrap:anywhere}.error-diagnostic-copy{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:1px solid currentColor;border-radius:8px;background:transparent;color:inherit;font-size:18px;line-height:1}.error-diagnostic-copy:focus-visible{outline:2px solid #165fdd;outline-offset:1px}[data-error-copy-result]{font-weight:700}[data-error-copy-result]:empty{display:none}.error-diagnostic-notice:has([data-error-copy-result]:not(:empty)){flex-wrap:wrap}.error-diagnostic-notice:has([data-error-copy-result]:not(:empty)) [data-error-copy-result]{flex:1 0 100%}#toast[data-manual=true]{max-height:150px}.error-diagnostic-notice+[data-error-diagnostic-manual]{display:block;width:100%;min-height:62px;margin-top:4px;padding:5px;border:1px solid currentColor;border-radius:6px;background:#fff;color:#17221d;font:10px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace;resize:vertical}.error-diagnostic-notice+[data-error-diagnostic-manual][hidden]{display:none}
@media(max-width:760px){.brand:has(#toast:not(:empty)){flex-wrap:wrap}.brand:has(#toast:not(:empty)) #toast{flex-basis:100%;max-height:72px}.brand:has(#toast[data-manual=true]) #toast{max-height:170px}.error-diagnostic-notice{align-items:center}}
[data-r2tg-theme="tg-dark"] .error-diagnostic-notice+[data-error-diagnostic-manual]{background:#181818;color:#f1f1f1;border-color:#555}

/* TASK-098: truthful chat-history loading and bounded recovery. */
.chat-history-loading,.chat-history-error{position:absolute;z-index:4;top:14px;right:16px;left:16px;display:grid;gap:9px;padding:12px 14px;border:1px solid #b9d9eb;border-radius:12px;background:#f4fbff;color:#315f79;box-shadow:0 8px 24px #17384d1f}.chat-history-loading p{font-size:12px;font-weight:700}.chat-history-progress{height:6px;overflow:hidden;border-radius:999px;background:#d8eaf4}.chat-history-progress>span{display:block;width:38%;height:100%;border-radius:inherit;background:#229ed9;animation:chat-history-indeterminate 1.15s ease-in-out infinite}.chat-history-error{gap:5px;border-color:#e3c4c8;background:#fff7f7;color:#8d3941}.chat-history-error span{font-size:12px;line-height:1.4}.chat-history-error button{justify-self:start;margin-top:4px;border-color:#dfc2c5;color:#923d45}
@keyframes chat-history-indeterminate{0%{transform:translateX(-115%)}50%{transform:translateX(85%)}100%{transform:translateX(265%)}}
[data-r2tg-theme="tg-dark"] .chat-history-loading{border-color:#365867;background:#182a32;color:#d8edf7}[data-r2tg-theme="tg-dark"] .chat-history-progress{background:#314955}[data-r2tg-theme="tg-dark"] .chat-history-error{border-color:#74474c;background:#342326;color:#ffd9dc}[data-r2tg-theme="tg-dark"] .chat-history-error button{border-color:#805158;background:#422a2e;color:#ffd4d7}
@media(max-width:500px){.chat-history-loading,.chat-history-error{top:12px;right:12px;left:12px;padding:10px 12px;border-radius:10px}}
@media(prefers-reduced-motion:reduce){.chat-history-progress>span{width:100%;animation:none;opacity:.78}}

/* TASK-338: reserve the polite notice slot so Refresh does not move between idle and feedback states. */
.app-header{height:auto}.app-header .brand{flex:1;min-width:0}.app-header #toast:empty{display:block;min-height:18px;visibility:hidden}
.app-header #toast:not([data-manual=true]):has(.error-diagnostic-notice){height:18px;max-height:18px;overflow:visible}.app-header #toast:not([data-manual=true]) .error-diagnostic-notice{position:relative;height:18px;padding-right:50px}.app-header #toast:not([data-manual=true]) .error-diagnostic-notice [data-error-message]{max-height:18px;overflow:auto}.app-header #toast:not([data-manual=true]) .error-diagnostic-copy{position:absolute;top:50%;right:0;transform:translateY(-50%)}
@media(max-width:760px){.app-header .brand{flex-wrap:wrap}.app-header .brand #toast{flex-basis:100%;max-height:72px}.app-header #toast:not([data-manual=true]) .error-diagnostic-copy{top:auto;bottom:0;transform:none}}

/* TASK-279: keep retained Undo and Refresh error controls in separate hit areas. */
.app-header #toast:not([data-manual=true]):has(>.toast-action-notice):has(>[data-refresh-live-notice]){display:flex;height:44px;max-height:44px;align-items:center;gap:8px;overflow:visible}.app-header #toast:not([data-manual=true]):has(>.toast-action-notice):has(>[data-refresh-live-notice])>.toast-action-notice,.app-header #toast:not([data-manual=true]):has(>.toast-action-notice):has(>[data-refresh-live-notice])>[data-refresh-live-notice]{flex:1 1 0;min-width:0}.app-header #toast:not([data-manual=true]):has(>.toast-action-notice):has(>[data-refresh-live-notice]) .error-diagnostic-notice{height:44px;padding-right:0}.app-header #toast:not([data-manual=true]):has(>.toast-action-notice):has(>[data-refresh-live-notice]) .error-diagnostic-copy{position:static;transform:none}

/* TASK-358: keep action recovery controls readable without changing retry behavior. */
#crm-action-form .crm-primary,#crm-action-preview .crm-primary,#crm-action-preview #crm-use-draft{min-height:44px}
[data-r2tg-theme="tg"] #crm-action-form .crm-primary,[data-r2tg-theme="tg"] #crm-action-preview .crm-primary{background:#0b5cad;color:#fff}
[data-r2tg-theme="tg-dark"] #crm-action-form .crm-primary,[data-r2tg-theme="tg-dark"] #crm-action-preview .crm-primary{background:#5b49b6;color:#fff}
[data-r2tg-theme="tg"] #crm-action-preview #crm-use-draft{background:#eff5f9;color:#2b6385}
[data-r2tg-theme="tg-dark"] #crm-action-preview #crm-use-draft{background:#30293e;color:#dcd5ff}
[data-r2tg-theme="tg"] #crm-action-error.crm-warning{color:#76520d}
[data-r2tg-theme="tg-dark"] #crm-action-error.crm-warning{color:#f4c978}
[data-r2tg-theme="tg"] #crm-action-form :focus-visible,[data-r2tg-theme="tg"] #crm-action-preview :focus-visible{outline:3px solid #000;outline-offset:2px}
[data-r2tg-theme="tg-dark"] #crm-action-form :focus-visible,[data-r2tg-theme="tg-dark"] #crm-action-preview :focus-visible{outline:3px solid #dcd5ff;outline-offset:2px}
.app-header #toast .error-diagnostic-notice{display:flex;position:static;min-height:26px;height:auto;padding-right:0;gap:4px}.app-header #toast:not([data-manual=true]):has(.error-diagnostic-notice){height:auto;max-height:none}.app-header #toast .error-diagnostic-copy,.app-header #toast .error-diagnostic-dismiss{position:static;transform:none;flex:0 0 26px;width:26px;height:26px;min-width:26px;min-height:26px;padding:4px;border:0;border-radius:6px;margin:0;background:transparent;color:inherit}.app-header #toast .error-diagnostic-copy svg,.app-header #toast .error-diagnostic-dismiss svg{width:16px;height:16px}.app-header #toast .error-diagnostic-notice [data-error-message]{max-height:none;overflow:hidden;text-overflow:ellipsis}
.image-viewer-dialog{height:calc(100dvh - 32px);max-height:calc(100dvh - 32px);width:calc(100dvw - 32px);max-width:1100px;margin:auto}.image-viewer-stage{min-width:0;overflow:hidden}.image-viewer-stage img{position:absolute;inset:16px;width:calc(100% - 32px);height:calc(100% - 32px);max-width:calc(100% - 32px);max-height:calc(100% - 32px);object-fit:contain}@media(max-width:600px){.image-viewer-dialog{height:100dvh;max-height:100dvh;width:100dvw;max-width:100dvw}.image-viewer-stage img{inset:8px;width:calc(100% - 16px);height:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100% - 16px)}}
/* Telegram presence is independent from the configured CRM/source badge. */
.chat-availability.telegram-online{background:#31b545}
.telegram-presence{color:#84929e}
.telegram-presence[data-online=true]{color:#279c3b}
.telegram-profile-field{display:flex;align-items:center;gap:4px;margin:8px 0}
.telegram-profile-copy-value,.telegram-profile-copy-icon{border:0;background:transparent;color:inherit;min-height:0;min-width:0;padding:0;cursor:pointer}
.telegram-profile-copy-value{text-align:left;font:inherit;overflow-wrap:anywhere}
.telegram-profile-copy-icon{display:grid;place-items:center;width:22px;height:22px;flex:0 0 22px;color:#84929e}
.telegram-profile-copy-icon svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.7}
[data-telegram-copy]:hover{color:#247dad}
#chat-list{scrollbar-width:thin;scrollbar-color:transparent transparent}
#chat-list.is-scrolling{scrollbar-color:#8b9ba680 transparent}
#chat-list::-webkit-scrollbar{width:6px}
#chat-list::-webkit-scrollbar-track{background:transparent}
#chat-list::-webkit-scrollbar-thumb{background:transparent;border-radius:3px}
#chat-list.is-scrolling::-webkit-scrollbar-thumb{background:#8b9ba680}
#workspace-view .composer-input{gap:3px}
#composer-emoji-toggle{margin-left:0;margin-right:0}
.message p .telegram-emoji{display:inline-block;width:1.25em;height:1.25em;vertical-align:-.25em;object-fit:contain;max-width:none}
.app-header #toast{max-width:min(420px,100%);min-width:0}
.app-header #toast .error-diagnostic-notice{max-width:100%;min-width:0;flex-wrap:nowrap}
.app-header #toast .error-diagnostic-notice [data-error-message]{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.app-header #toast .error-diagnostic-notice [data-error-copy-result]{flex:0 0 auto;font-size:11px;white-space:nowrap}
.show-in-control,.translate-to-control{position:relative;display:grid;place-items:center;width:44px;height:44px;min-width:44px;border-radius:10px;color:#607786;overflow:hidden;cursor:pointer}
.show-in-control{width:34px;height:34px;min-width:34px;margin-left:5px;border:1px solid #c7d8e3;background:var(--surface,#fff)}
.show-in-control select,.translate-to-control select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.show-in-control:has(select:focus-visible),.translate-to-control:has(select:focus-visible){outline:3px solid #165fdd;outline-offset:-3px}
.show-in-control.is-active,.translate-to-control.is-active{background:#e8f6fc;color:#1677a8}
.translation-language-code{font-size:16px;font-weight:600;line-height:1;pointer-events:none}
[data-code-style="latin"] .translation-language-code{font-size:12px;font-weight:700;letter-spacing:.02em}
.show-in-control:has(select:disabled),.translate-to-control:has(select:disabled){opacity:.45;cursor:not-allowed}
[data-r2tg-theme] .message.has-translation,.message.has-translation{box-shadow:4px 4px 0 #dfeaf2,5px 5px 0 #c2d5e3;margin-bottom:5px}
#messages .message-row>.message-translation-switch{display:block;align-self:flex-end;flex:0 0 auto;width:auto;min-width:0;min-height:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;color:#fff;font-family:inherit;font-size:11px;font-weight:500;line-height:1.25;white-space:nowrap;margin:4px 4px 0 0;cursor:pointer}
.message-translation-switch:hover{text-decoration:underline}
.message-translation-switch:focus-visible{outline:2px solid #3390ec;outline-offset:2px}
[data-r2tg-theme="tg-dark"] .show-in-control,[data-r2tg-theme="tg-dark"] .translate-to-control{color:#a9bac5}
[data-r2tg-theme="tg-dark"] .show-in-control select{border-color:#425766;background:#1f2d36;color:#e2edf3}
[data-r2tg-theme="tg-dark"] .message.has-translation{box-shadow:4px 4px 0 #1d303d,5px 5px 0 #405766}
:root[data-r2tg-theme="tg-dark"] #messages .message-row>.message-translation-switch{color:#70baff}
@media(max-width:760px){.show-in-control{margin-left:3px}}

.settings-translation label{grid-template-columns:minmax(0,1fr);gap:5px}.settings-translation select{width:100%;font-size:12px}.settings-translation small{color:#8a9aa5;font-size:10px;line-height:1.4}

#show-in-language,#translate-to-language,#show-in-language option,#translate-to-language option{font-family:inherit;font-size:13px;font-weight:700}
#composer #composer-resize-strip{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 48px;align-items:center;gap:3px;min-height:34px;margin-bottom:4px;padding-inline:6px;border-inline:1px solid transparent}
#composer .composer-toolbar-left{display:flex;align-items:center;gap:3px;justify-self:start}
#composer .composer-toolbar-right{display:flex;justify-content:center;width:48px}
#composer .composer-toolbar-left .icon-button{width:34px;height:34px;min-width:34px;min-height:34px;padding:0}
#composer .composer-toolbar-right .translate-to-control{width:48px;min-width:48px;height:34px}
#composer #composer-resize{top:0;height:34px}
#composer .composer-input{display:grid;grid-template-columns:minmax(0,1fr) 48px;align-items:end;gap:3px}
#composer .composer-actions{width:48px;min-width:48px;margin:0}
#composer #send-message{width:48px;min-width:48px}
#composer #draft{width:100%;min-width:0;margin:0}
#composer .composer-toolbar-left #attach-photo svg,#composer .composer-toolbar-left #scheduled-toggle svg{width:24px;height:24px}
#composer #send-message{position:relative;overflow:visible}
#composer #send-message .send-language{position:absolute;right:-3px;bottom:-3px;display:grid;place-items:center;width:20px;height:20px;border:1px solid #fff;border-radius:50%;background:#d9efff;color:#075a94;font-family:inherit;font-size:10px;font-weight:800;line-height:1;pointer-events:none}
#composer #send-message .send-language[hidden]{display:none}
#composer .composer-toolbar-left #attach-photo svg{width:20px;height:20px;transform:translateY(2px)}
#composer .composer-toolbar-right .translate-to-control{transform:translateY(2px)}
