:root{font-family:Inter,"Segoe UI",Arial,sans-serif;color:#20342b;background:#eff3f0;--green:#22543d;--ink:#20342b;--muted:#728179;--line:#dce5df;--panel:#fff;--soft:#f4f8f5;--warn:#a6661c;--danger:#b3473d;font-size:14px}
*{box-sizing:border-box}body{margin:0;height:100dvh;display:grid;grid-template-rows:64px 80px minmax(0,1fr) 60px;overflow:hidden}button,input,textarea,select{font:inherit;color:inherit}button{border:1px solid var(--line);border-radius:9px;padding:8px 12px;background:white;cursor:pointer;transition:background .14s,box-shadow .14s,transform .12s;line-height:1.25}button:hover:not(:disabled){background:#edf5ef;box-shadow:0 2px 7px #15321f0c}button:active:not(:disabled){transform:scale(.97)}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid #6fa98b;outline-offset:2px}button:disabled{opacity:.48;cursor:default}button.primary{background:var(--green);color:#fff;border-color:var(--green)}button.primary:hover:not(:disabled){background:#2c674b}button.busy::before{content:"";display:inline-block;vertical-align:-2px;width:12px;height:12px;margin-right:7px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .65s linear infinite}.icon{padding:5px 9px;background:transparent;border:0;font-size:22px;line-height:1}.text-button{border:0;background:transparent;padding:4px;color:var(--green);font-size:12px}h1,h2,p{margin:0}h2{font-size:15px;line-height:1.3}small,.muted{color:var(--muted)}[hidden]{display:none!important}.top{display:flex;align-items:center;justify-content:space-between;padding:0 24px;background:white;border-bottom:1px solid var(--line);gap:12px}.brand{display:flex;align-items:center;gap:10px}.brand strong{display:block;font-size:19px;letter-spacing:1px}.brand small{display:block;font-size:10px;margin-top:2px}.brand-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:11px;background:var(--green);color:white;font-weight:800;font-size:20px}.top-actions{display:flex;align-items:center;gap:18px}#connection{font-size:11px;color:var(--muted)}.strip{display:grid;grid-template-columns:25px minmax(0,1fr) 25px;align-items:center;padding:10px 22px;gap:8px}#accounts{display:flex;gap:8px;overflow:hidden;scroll-behavior:smooth;padding:3px 2px}.chip{flex:0 0 calc((100% - 56px)/8);min-width:120px;max-width:220px;height:54px;text-align:left;border-radius:12px;padding:8px 11px;position:relative;overflow:hidden}.chip strong,.chip small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chip strong{font-size:13px}.chip small{font-size:11px;margin-top:4px}.chip.active{border-color:#86b199;background:#f6fcf8;box-shadow:inset 0 0 0 1px #86b199}.chip.loading::after{content:"";position:absolute;right:7px;top:7px;width:10px;height:10px;border:2px solid #c8dfd2;border-right-color:var(--green);border-radius:50%;animation:spin .7s linear infinite}
main{min-height:0;min-width:0;display:grid;grid-template-columns:246px minmax(0,1fr);gap:12px;padding:0 22px}.panel{background:var(--panel);border:1px solid var(--line);border-radius:14px;min-height:0;min-width:0;overflow:hidden}.groups{display:flex;flex-direction:column;padding:13px 10px 8px}.groups-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 4px 8px}.groups-head small{display:block;margin-top:3px;font-size:11px}#group-search{flex:0 0 auto;width:100%;padding:7px 9px;border:1px solid var(--line);border-radius:8px;font-size:12px;margin-bottom:8px;background:var(--soft)}.group-list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-gutter:stable;scrollbar-width:thin;overscroll-behavior:contain}.group-item{display:flex;align-items:stretch;border-radius:9px;margin:2px 0;border:1px solid transparent;min-height:51px}.group-item.active{background:#edf6f0;border-color:#d7e9dd}.group-select{flex:1;min-width:0;border:0;text-align:left;background:transparent;padding:8px 7px;border-radius:8px;box-shadow:none!important}.group-select strong,.group-select small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.group-select strong{font-size:12px}.group-select small{font-size:10px;margin-top:3px}.group-menu-btn{flex:0 0 24px;padding:3px 4px;border:0;background:transparent;font-size:18px;opacity:.55}.group-item:hover .group-menu-btn{opacity:1}.groups-foot{padding:8px 4px 0;font-size:10px;color:var(--muted);line-height:1.35;max-height:40px;overflow:hidden}.group-work{display:flex;flex-direction:column}.group-head{padding:13px 17px 10px;display:flex;justify-content:space-between;align-items:center;gap:10px;flex-shrink:0;min-height:68px}#source-label{font-size:9px;letter-spacing:1.25px;color:var(--green);font-weight:600}#group-title{font-size:21px;line-height:1.15;margin:3px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.group-head>div{min-width:0}#group-meta{font-size:11px;color:var(--muted);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#bots{font-size:11px;white-space:nowrap}.process-board{display:flex;gap:7px;margin:0 16px 10px;min-height:34px;max-height:65px;overflow:auto;scrollbar-width:thin;flex-shrink:0;align-items:center}.process{display:flex;gap:9px;align-items:center;flex:0 0 auto;border:1px solid var(--line);background:var(--soft);padding:6px 8px;border-radius:8px;font-size:11px;max-width:350px}.process-copy{min-width:0}.process-copy strong,.process-copy small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:245px}.process small{font-size:10px}.process button{padding:3px 6px;font-size:10px}.dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#b3bdb7;flex-shrink:0}.dot.on{background:#3c9666;box-shadow:0 0 0 3px #3c966614}.monitor-layout{display:grid;grid-template-columns:282px minmax(0,1fr);flex:1;min-height:0;border-top:1px solid var(--line)}.monitor-controls{min-height:0;min-width:0;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:13px 15px;overflow:auto;scrollbar-width:thin;gap:8px}.control-heading{display:flex;justify-content:space-between;align-items:center}.switch{display:inline-flex;position:relative;cursor:pointer}.switch input{position:absolute;opacity:0;width:38px;height:22px;margin:0}.switch span{width:38px;height:22px;border-radius:15px;background:#d9e2dc;position:relative;transition:background .18s}.switch span::after{content:"";width:16px;height:16px;border-radius:50%;background:#fff;position:absolute;top:3px;left:3px;box-shadow:0 1px 3px #0002;transition:transform .18s}.switch input:checked+span{background:var(--green)}.switch input:checked+span::after{transform:translateX(16px)}.switch input:focus-visible+span{outline:2px solid #6fa98b;outline-offset:2px}#monitor-status{font-size:11px;color:var(--muted);line-height:1.35;min-height:16px}#monitor-status.error{color:var(--danger)}.metrics{display:flex;gap:8px;padding:8px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.metrics>div{flex:1}.metrics b{font-size:20px;font-weight:600;display:block;line-height:1.1}.metrics small{font-size:9px;display:block;margin-top:3px}.field{display:flex;flex-direction:column;gap:5px;font-size:11px;color:#4c6256}.field input,.field select,.field textarea,.auth-form input{width:100%;min-width:0;background:#fff;border:1px solid var(--line);border-radius:8px;padding:8px;color:var(--ink);font-size:12px}.field textarea{resize:none;line-height:1.4}.field-help{font-size:10px;color:var(--muted);line-height:1.45}.action-settings{border-top:1px solid var(--line);padding-top:10px;display:flex;flex-direction:column;gap:8px}.action-settings h2{font-size:13px}.check{display:flex;align-items:center;gap:7px;font-size:11px;cursor:pointer}.check input{accent-color:var(--green);margin:0}.save-state{font-size:9px;min-height:12px;color:var(--muted)}.run-actions{display:flex;gap:7px;margin-top:auto;padding-top:6px;flex-shrink:0}.run-actions button{flex:1;white-space:nowrap;font-size:12px}#config-note.error{color:var(--danger)}.feed-panel{display:flex;flex-direction:column;min-height:0;min-width:0;position:relative;background:#fafcfb}.feed-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px 14px 6px;flex-shrink:0}.feed-head small{font-size:10px;display:block;margin-top:3px}.feed-tools{display:flex;gap:6px}.feed-tools button{font-size:11px;padding:6px 9px}.feed-tools span{background:#e7f1eb;color:var(--green);border-radius:10px;font-size:10px;padding:1px 5px;margin-left:3px}.feed-pages{display:flex;justify-content:space-between;min-height:24px;padding:0 14px 4px;flex-shrink:0}.messages{flex:1;min-height:0;padding:4px 14px 10px;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;scrollbar-width:thin}.message-card{background:#fff;border:1px solid var(--line);border-radius:11px;margin-bottom:9px;padding:11px;overflow-wrap:anywhere;animation:card-in .13s ease-out}.message-card header{display:flex;align-items:center;gap:8px;line-height:1.3}.avatar{background:#e5f0e9;color:var(--green);width:29px;height:29px;border-radius:9px;display:grid;place-items:center;font-weight:600;flex-shrink:0;font-size:12px}.author{flex:1;min-width:0}.author strong{font-size:12px}.author small{display:block;font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.message-card time{font-size:10px;color:var(--muted);white-space:nowrap}.message-text{font-size:12px;white-space:pre-wrap;line-height:1.5;margin-top:8px}.empty-feed{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;color:var(--muted);gap:10px;min-height:160px}.empty-feed span{font-size:32px;color:#a4b8aa}.empty-feed strong{font-size:15px;color:#63796b}.empty-feed p{font-size:12px;line-height:1.6}.feed-foot{display:flex;justify-content:space-between;gap:8px;border-top:1px solid var(--line);padding:7px 14px;font-size:9px;color:var(--muted);flex-shrink:0}.new-messages{position:absolute;bottom:37px;left:50%;transform:translateX(-50%);border-color:#a6c8b3;background:#eaf5ee;font-size:11px;box-shadow:0 4px 14px #0001;white-space:nowrap}.bottom-bar{padding:8px 24px;display:flex;justify-content:space-between;align-items:center;gap:12px}.bottom-bar>span{color:var(--muted);font-size:10px}.bottom-bar>div{display:flex;align-items:center;gap:12px}#consoleBtn{font-size:12px}.chat-fab{width:40px;height:40px;border-radius:50%;padding:0;background:var(--green);color:#fff;border:0;font-size:18px}.order-menu{position:fixed;background:#fff;border:1px solid var(--line);border-radius:10px;padding:5px;box-shadow:0 8px 26px #10251a26;z-index:70;width:195px}.order-menu button{width:100%;border:0;text-align:left;font-size:12px;padding:8px}.order-menu hr{border:0;border-top:1px solid var(--line);margin:4px}.chat{position:fixed;right:22px;bottom:65px;width:345px;height:min(470px,75dvh);background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:0 14px 40px #12281b26;z-index:60;display:flex;flex-direction:column;overflow:hidden}.chat header{display:flex;justify-content:space-between;align-items:center;padding:9px 12px;border-bottom:1px solid var(--line)}#chatHistory{flex:1;min-height:0;overflow:auto;padding:12px;font-size:12px}.mini-msg{margin-bottom:12px;white-space:pre-wrap;line-height:1.5}.mini-msg.user{margin-left:24px}.mini-msg b{display:block;font-size:10px;color:var(--muted)}#chatForm{display:grid;grid-template-columns:1fr 35px;gap:6px;border-top:1px solid var(--line);padding:9px}#chatInput{resize:none;border:1px solid var(--line);border-radius:8px;padding:7px;min-height:45px;font-size:12px}dialog{padding:0;border:1px solid var(--line);border-radius:16px;width:620px;max-width:calc(100vw - 36px);max-height:calc(100dvh - 40px);box-shadow:0 20px 80px #112b2233;color:var(--ink)}dialog::backdrop{background:#17332655;backdrop-filter:blur(2px)}dialog>header{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:16px 18px;border-bottom:1px solid var(--line)}dialog h2{font-size:18px}#modalBody{padding:18px}.auth-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:15px 0}.auth-choice{text-align:left;padding:16px 12px;border-radius:12px;min-height:105px}.auth-choice b{display:block;margin:7px 0;font-size:13px}.auth-choice small{display:block;font-size:10px;line-height:1.5}.auth-form{display:grid;gap:11px}.auth-form label{font-size:12px;display:grid;gap:5px}.auth-note{border-radius:9px;background:#f5f1e8;padding:10px;font-size:11px;line-height:1.5;color:#826437}.auth-error{color:var(--danger);font-size:12px;white-space:pre-wrap}.qr-box{display:flex;flex-direction:column;align-items:center;gap:9px;text-align:center}.qr-box img{width:215px;height:215px;background:white}.qr-box a{color:var(--green);padding:8px}.auth-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:7px}.review-dialog{width:820px}.review-dialog>header p{font-size:11px;margin-top:4px;color:var(--muted)}.review-toolbar{padding:10px 16px;display:flex;gap:12px;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.review-toolbar span{font-size:11px;color:var(--muted)}.review-list{max-height:55dvh;overflow:auto;padding:13px 16px;background:var(--soft)}.review-card{background:#fff;border:1px solid var(--line);padding:12px;margin-bottom:9px;border-radius:11px}.review-card header{display:flex;gap:9px;align-items:center}.review-actions{display:flex;gap:8px;align-items:center;margin-top:10px}.review-actions button{font-size:11px}.review-actions small{font-size:10px}.review-dialog footer{padding:10px 16px;display:flex;align-items:center;justify-content:space-between;font-size:11px}.console-dialog{width:790px}#consoleBody{padding:16px;max-height:65dvh;overflow:auto}.console-row{display:flex;align-items:baseline;gap:10px;border-bottom:1px solid var(--line);padding:8px 0;font-size:12px;line-height:1.5}.console-row time{color:var(--muted);font-size:10px;white-space:nowrap}.scaffold{padding:14px;border:1px dashed #afc6b8;border-radius:12px;margin-bottom:10px}.scaffold p{font-size:12px;color:var(--muted);line-height:1.6;margin:7px 0}.scaffold button{font-size:12px;margin:4px}#toast{position:fixed;bottom:65px;left:50%;transform:translateX(-50%);max-width:650px;background:#253b2e;color:white;border-radius:10px;padding:11px 16px;box-shadow:0 5px 25px #0002;font-size:12px;z-index:1000;line-height:1.5}
@keyframes spin{to{transform:rotate(360deg)}}@keyframes card-in{from{opacity:.55;transform:translateY(3px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media(min-width:1700px){main{grid-template-columns:280px minmax(0,1fr)}.monitor-layout{grid-template-columns:320px minmax(0,1fr)}.monitor-controls{gap:12px;padding:18px}.message-text{font-size:14px}.field input,.field textarea,.field select{font-size:13px}}
@media(max-height:750px) and (min-width:1050px){body{grid-template-rows:54px 66px minmax(0,1fr) 48px}.top{padding:0 18px}.strip{padding:7px 17px}.chip{height:47px;padding:6px 9px}.group-head{padding:9px 13px 7px;min-height:55px}#group-title{font-size:19px}.process-board{margin:0 12px 6px;min-height:27px;max-height:49px}.process{padding:4px 7px}.monitor-controls{padding:9px 12px;gap:5px}.metrics{padding:5px 0}.metrics b{font-size:17px}.action-settings{padding-top:7px;gap:5px}.field{gap:3px}.field select,.field textarea{padding:6px 7px}.field-help{font-size:9px;line-height:1.35}.run-actions{padding-top:4px}.run-actions button{padding:6px 8px}.feed-head{padding:9px 11px 5px}.bottom-bar{padding:5px 20px}.chat-fab{height:35px;width:35px}}
@media(max-width:1180px){main{grid-template-columns:216px minmax(0,1fr);padding:0 12px;gap:8px}.monitor-layout{grid-template-columns:252px minmax(0,1fr)}.feed-tools{gap:3px}.feed-tools button{padding:6px;font-size:10px}.group-head{padding:11px 12px}.process-board{margin-left:12px;margin-right:12px}.chip{min-width:118px}.top-actions #connection{display:none}}
@media(max-width:900px){.monitor-layout{grid-template-columns:220px minmax(0,1fr)}main{grid-template-columns:185px minmax(0,1fr)}.feed-head{flex-wrap:wrap}.brand small{display:none}.top{padding:0 12px}.bottom-bar>span{display:none}.monitor-controls{padding:10px;overflow:auto}.top-actions button{font-size:12px}.auth-options{grid-template-columns:1fr}.auth-choice{min-height:0;padding:10px}}

/* Keep Start/Stop reachable even on a short laptop viewport. */
.monitor-controls{padding:0;gap:0;overflow:hidden}
.control-scroll{display:flex;flex-direction:column;gap:7px;flex:1;min-height:0;overflow-y:auto;padding:11px 13px;scrollbar-width:thin;overscroll-behavior:contain}
.run-actions{padding:9px 12px;margin:0;border-top:1px solid var(--line);background:#fff}
@media(max-height:750px) and (min-width:1050px){.control-scroll{gap:4px;padding:7px 10px}.control-scroll .field-help{font-size:9px;line-height:1.25}.control-scroll .action-settings{padding-top:5px;gap:4px}.run-actions{padding:6px 10px}}

/* Cached role checks are distinct from explicitly enabled background work. */
.process-scope{align-self:center;flex:0 0 auto;color:var(--muted);font-size:11px;padding-right:6px}

/* Account / own-bot / moderation tools v9 */
.chip.has-incoming{border-color:#d7a641;background:#fffbeb;position:relative}.account-incoming{position:absolute;right:6px;top:5px;border-radius:20px;background:#b74625;color:white;font-size:10px;padding:1px 5px;min-width:17px;cursor:pointer}.studio-tabs{overflow-x:auto;flex-shrink:0;scrollbar-width:thin}.studio-tabs button{white-space:nowrap}.mod-form select,.desk-thread{font:inherit}.mod-form .db-table input[type=checkbox]{width:15px;height:15px}.mod-form .db-table select{max-width:230px}.bot-row details{margin-top:8px}.bot-row .studio-actions{flex-wrap:wrap}.bot-row{margin:9px 0}.desk-inbox{display:grid;grid-template-columns:230px minmax(0,1fr);height:430px;max-height:calc(100dvh - 360px);min-height:220px;margin-top:12px;border:1px solid var(--line);border-radius:12px;overflow:hidden}.desk-threads{overflow:auto;border-right:1px solid var(--line);min-height:0}.desk-thread{width:100%;border:0;border-radius:0;border-bottom:1px solid var(--line);text-align:left;padding:10px}.desk-thread strong,.desk-thread small,.desk-thread span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.desk-thread.active{background:#eaf3ec}.desk-thread small,.desk-thread>span{font-size:11px;color:var(--muted);margin-top:4px}.desk-conversation{display:flex;flex-direction:column;min-height:0;min-width:0}.desk-messages{overflow:auto;flex:1;padding:10px;min-height:0}.desk-messages .own-message{margin-left:30px;background:#f0f6f1}.desk-conversation #desk-compose{display:flex;gap:8px;padding:9px;border-top:1px solid var(--line)}#desk-reply-text{flex:1;min-width:0;resize:vertical}#desk-drafts{max-height:150px;overflow:auto}#desk-drafts article{padding:8px;background:#fffcf0}#desk-drafts textarea{display:block;width:100%;min-height:48px}.studio-job .studio-actions{flex-wrap:wrap}.mod-form .db-table-wrap{overflow:auto}@media(max-width:1050px){.desk-inbox{grid-template-columns:180px minmax(0,1fr)}.studio-tabs{gap:4px}.studio-tabs button{padding:6px;font-size:11px}#account-tools{font-size:11px}}

.bot-row header strong,.bot-row header small{display:block}.bot-row header small{margin-top:4px;color:var(--muted)}.mod-form .studio-actions{position:sticky;bottom:0;padding:8px 0;background:var(--panel);z-index:1}

/* Standard Telegram login: two clear choices, readable help, no API form. */
#modal .auth-choice{border:1px solid #a9c8ba;background:#f0f8f4;font-size:18px;min-height:130px;padding:18px}#modal .auth-choice b{font-size:16px}#modal .auth-choice small,#modal .field-help{font-size:12px;line-height:1.6}#modal .auth-choice:hover:not(:disabled){border-color:#247659;background:#e4f3eb}#modal .auth-choice:disabled{opacity:.6}#modal .auth-form label{font-size:13px}#modal .auth-form label>small{color:var(--muted)}#modal .auth-error:empty,#modal #auth-wait:empty{display:none}#modal .auth-error,#modal #auth-wait{margin-top:10px}#modal .auth-actions .primary{min-height:42px;padding:10px 20px}
