/* Secretary-inspired shared presentation. Existing permissions and workflows own actions. */
:root{--bg:#f4f4f5;--surface:#fff;--hover:#f4f4f5;--surface-2:#f4f4f5;--text:#111;--muted:#707579;--line:#e7e8ea;--border:var(--line);--accent:#3390ec;--primary:#3390ec;--soft:#e6f1fc;--good:#318752;--warn:#a46600;--bad:#d23c43;--tw-sidebar:80px;--bs-primary:#3390ec;--bs-primary-rgb:51,144,236;--secretary-in:#fff;--secretary-out:#eeffde;--secretary-chat:#d8e5c2;--secretary-pattern:#64843d15;--secretary-shadow:0 1px 2px #10232f18}
html[data-theme=dark]{--bg:#181818;--surface:#212121;--hover:#2c2c2c;--surface-2:#2b2b2b;--text:#f5f5f5;--muted:#aaa;--line:#353535;--border:var(--line);--accent:#aa9aff;--primary:#8774e1;--soft:#8774e126;--good:#78d399;--warn:#f0bd6d;--bad:#ff959b;--bs-primary:#8774e1;--bs-primary-rgb:135,116,225;--secretary-in:#212121;--secretary-out:#766ac8;--secretary-chat:#101619;--secretary-pattern:#ffffff07;--secretary-shadow:0 1px 2px #0003}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}
a{color:var(--accent)}
.tw-sidebar{width:var(--tw-sidebar);padding:6px 4px;background:var(--bg);border-right:1px solid var(--line);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;align-items:stretch;gap:3px}
.tw-brand{padding:5px 0 8px;justify-content:center;gap:0;min-height:48px;flex-shrink:0}
.tw-brand>span:last-child,.tw-nav-caption,.tw-version{display:none}
.tw-brand-icon{width:34px;height:34px;background:var(--primary);border-radius:50%;font-size:20px}
.tw-nav{gap:2px;flex-shrink:0}
.tw-sidebar .tw-nav-link{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:3px;min-height:60px;padding:7px 2px;border:0;border-radius:10px;background:transparent;box-shadow:none;font-size:10px;font-weight:400;line-height:1.25;color:var(--muted);text-align:center;width:100%;overflow-wrap:anywhere}
.tw-sidebar .tw-nav-link svg{width:25px;height:25px;flex-shrink:0}
.tw-sidebar .tw-nav-link:hover{background:var(--hover);color:var(--text)}
.tw-sidebar .tw-nav-link.active{background:var(--soft);color:var(--accent);box-shadow:none}
.tw-sidebar .tw-bottom{margin-top:auto;padding-top:14px}
.tw-workspace{margin-left:var(--tw-sidebar)}
.tw-header{height:56px;padding:0 18px;gap:8px;background:var(--surface)}
.tw-location{min-width:0;font-size:15px}
.tw-location-prefix{display:none}
#tw-current-section{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}
.tw-header-controls{gap:7px;flex-shrink:0}
.tw-header .btn-icon,.tw-header .tw-menu-toggle{border:0;border-radius:50%;box-shadow:none;width:38px;height:38px;min-height:38px;padding:8px;background:transparent;color:var(--muted)}
.tw-header .tw-inbox-link{border:0;border-radius:20px;box-shadow:none;background:var(--soft);color:var(--accent);font-size:12px;padding:6px 10px}
.tw-avatar,.avatar{border-radius:50%;background:var(--soft);color:var(--accent)}
.tw-avatar{width:34px;height:34px}
.tw-user{font-size:12px}
.tw-user small{font-size:10px}
#main-content>.page{padding:22px 24px;max-width:1800px}
.page-heading h1{font-size:23px;font-weight:600;letter-spacing:-.3px}
.btn,button:not(.module-card):not(.dialog-item){border-radius:8px;box-shadow:none;min-height:36px;font-weight:500}
.btn.primary,.btn.btn-primary,button.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn.primary:hover,.btn.btn-primary:hover,button.primary:hover{background:var(--primary);border-color:var(--primary);filter:brightness(.94);box-shadow:none}
input:not([type=checkbox]):not([type=radio]),select,textarea,.form-control,.form-select{border-radius:8px;background-color:var(--surface);color:var(--text);border-color:var(--line)}
input:not([type=checkbox]):not([type=radio]):focus,select:focus,textarea:focus,.form-control:focus,.form-select:focus{border-color:var(--primary);outline:0;box-shadow:0 0 0 2px color-mix(in srgb,var(--primary) 15%,transparent)}
input[type=search]{border-radius:22px;background-color:var(--surface-2)}
.form-check-input:checked{background-color:var(--primary);border-color:var(--primary)}
.card,.panel,.module-card{border-radius:12px;box-shadow:none;background:var(--surface);border-color:var(--line)}
.card{padding:18px}
.module-card:hover,.module-card.active{transform:none;box-shadow:none;border-color:var(--primary);background:var(--soft)}
.notice,.preview,.bulk-bar,.selection-strip{border-radius:10px}
.table th{background:var(--surface-2);text-transform:none;letter-spacing:0;color:var(--muted);font-size:12px}
.table td{border-color:var(--line)}
.table tbody tr:hover{background:var(--hover)}
.badge{border-radius:12px;letter-spacing:0}
.tabs .btn{border-radius:18px;background:transparent}
.tabs .btn.active{color:var(--accent);background:var(--soft)}
.setting-link{border-radius:9px}
.setting-link.active{background:var(--soft);color:var(--accent)}
.settings-nav{background:var(--surface)}
.setting-row{border-color:var(--line)}
.section-head,.surface-header,.modal-head{border-color:var(--line)}
dialog{border-radius:14px;background:var(--surface);border-color:var(--line);box-shadow:0 12px 60px #0003}
dialog::backdrop{background:#0006;backdrop-filter:blur(2px)}
#toast{border-radius:10px}
/* Conversations use the same compact list and optional inspector as Secretary. */
.inbox{height:calc(100dvh - 56px);grid-template-columns:360px minmax(0,1fr)}
.inbox .dialog-filters{padding:9px 12px 6px;background:var(--surface)}
.inbox .dialog-filters h2{font-size:16px}
.inbox #dialog-search{border-radius:22px;background:var(--surface-2);min-height:38px;font-size:12px}
.inbox .inbox-filter-details>summary{top:9px;border-radius:18px;font-size:11px;min-height:30px;background:var(--soft);color:var(--accent);border-color:transparent}
.inbox .inbox-quick-tabs{gap:0;border-bottom:1px solid var(--line);margin:3px -4px 0}
.inbox .inbox-quick-tabs button{position:relative;border:0;border-radius:0;background:transparent;box-shadow:none;font-size:12px;color:var(--muted);min-height:36px;padding:7px 8px}
.inbox .inbox-quick-tabs button.active{color:var(--accent);background:transparent}
.inbox .inbox-quick-tabs button.active:after{content:"";position:absolute;bottom:0;left:8px;right:8px;height:3px;border-radius:3px;background:var(--primary)}
.inbox .dialog-scroll{padding:5px 6px}
.inbox .dialog-item{border-radius:11px!important;padding:8px 9px;min-height:78px;align-items:center;margin-bottom:2px}
.inbox .dialog-item .avatar,.inbox .dialog-item .user-avatar{width:48px;height:48px;flex-basis:48px;font-size:18px}
.inbox .dialog-item .title{font-size:13px}
.inbox .dialog-item p{font-size:11px}
.inbox .dialog-item.active{background:var(--primary);color:#fff}
.inbox .dialog-item.active p,.inbox .dialog-item.active .dialog-state{color:#ffffffe0}
.inbox .dialog-item.active .dialog-stage{background:#ffffff29;color:#fff}
.inbox .dialog-item.active .unread{background:#fff;color:var(--primary)}
.inbox .chat{min-height:0;position:relative;background-color:var(--secretary-chat);background-image:radial-gradient(var(--secretary-pattern) 1.5px,transparent 1.5px);background-size:24px 24px}
.inbox .chat-header{background:var(--surface);padding:10px 16px;border-bottom:1px solid var(--line);flex:0 0 auto;gap:7px}
.inbox .chat-header h3{font-size:15px;font-weight:600}
.inbox .chat-header button:not(.user-profile-trigger):not(.user-profile-name){border:0;border-radius:18px;box-shadow:none;background:var(--hover);font-size:11px;min-height:30px;padding:5px 10px}
.inbox .chat-header [data-workspace-open]{background:var(--soft)!important;color:var(--accent)}
.inbox .messages{background:transparent;padding:20px max(16px,calc((100% - 850px)/2));flex:1;min-height:0}
.inbox .message{background:var(--secretary-in);border-radius:13px 13px 13px 4px;box-shadow:var(--secretary-shadow);padding:10px 13px;max-width:min(85%,680px);font-size:14px;line-height:1.5}
.inbox .message.outgoing{background:var(--secretary-out);border-radius:13px 13px 4px 13px}
.inbox .message time{color:var(--muted);font-size:10px}
html[data-theme=dark] .inbox .message.outgoing time{color:#ffffffb3}
.inbox .composer{background:var(--surface);border-top:1px solid var(--line);padding:10px 16px;flex-shrink:0}
.inbox .composer textarea{background:transparent;box-shadow:none;border:0;padding:8px 0;min-height:44px}
.inbox .composer button.primary{border-radius:22px}
.inbox .chat-info{display:none;background:var(--surface);padding:16px;overflow:auto;min-height:0}
.inbox .dialog-work-card [data-workspace-close]{display:block;border:0;border-radius:50%;padding:2px 9px;font-size:20px;min-height:30px;background:transparent}
.inbox .workspace-section{border-radius:10px}
.inbox .workspace-section>summary{margin-bottom:0}
.inbox .workspace-section[open]>summary{margin-bottom:8px}
.inbox .dialog-state-line{border-radius:9px;background:var(--soft);color:var(--text)}
.inbox .dialog-work-card textarea{min-height:70px}
.inbox .inbox-filter-popup{border-radius:13px;background:var(--surface)}
.inbox .dialog-lead-compact{background:var(--surface)}
@media(min-width:1251px){
 .inbox.workspace-card-open,.inbox.profile-open{grid-template-columns:340px minmax(0,1fr) 300px}
 .inbox.workspace-card-open .chat-info,.inbox.profile-open .chat-info{display:block;position:static;width:auto;box-shadow:none}
}
@media(min-width:701px) and (max-width:1250px){.inbox{display:grid;grid-template-columns:310px minmax(0,1fr)}.inbox.open .dialog-list{display:flex}.inbox .chat{display:flex;height:100%}}
@media(max-width:1250px){.inbox.workspace-card-open .chat-info,.inbox.profile-open .chat-info{display:block;position:fixed;right:0;top:56px;bottom:0;width:min(360px,100vw);z-index:50;box-shadow:-8px 0 24px #0003;background:var(--surface);overflow:auto}}
@media(max-width:991px){
 .tw-sidebar{width:88px;transform:translateX(-100%)}
 .tw-menu-open .tw-sidebar{transform:translateX(0)}
 .tw-workspace{margin-left:0}
 .tw-header{height:56px;padding:0 12px}
 .tw-menu-toggle{display:inline-flex}
 .tw-user{display:none}
 #main-content>.page{padding:18px 16px}
}
@media(max-width:700px){
 .inbox{display:flex;position:relative;height:calc(100dvh - 56px)}
 .inbox .dialog-list{width:100%;height:100%;flex-shrink:0}
 .inbox .chat{display:none}
 .inbox.open .dialog-list{display:none}
 .inbox.open .chat{display:flex;width:100%;height:100%}
 .inbox .back-chat{display:inline-flex}
 .inbox.workspace-card-open .chat-info,.inbox.profile-open .chat-info{width:100%;top:56px}
 .inbox .messages{padding:14px 10px}
 .inbox .message{max-width:92%;font-size:13px}
 .inbox .chat-header{padding:9px 10px}
 .inbox .chat-header .row{gap:5px}
 .inbox .composer{padding:9px 12px}
}
@media(max-width:600px){
 .tw-location{font-size:13px;gap:6px}
 .tw-header-controls{gap:3px}
 .tw-header .btn-icon{width:34px;height:34px;min-height:34px}
 .tw-header .tw-inbox-link{padding:5px 8px}
 #main-content>.page{padding:16px 12px}
 .page-heading h1{font-size:21px}
 .card{padding:14px}
 #workspace-modal,#workspace-modal[data-kind=settings],#workspace-modal[data-kind=wizard],#workspace-modal[data-kind=tool]{border-radius:0}
}
/* The login screen shares the service palette and controls. */
.login-page{background:var(--bg)}
.login-card{border:1px solid var(--line);box-shadow:none;border-radius:18px;padding:32px;max-width:100%}
.login-card .brand-mark{border-radius:50%;background:var(--primary);color:#fff}
.login-card .primary{border-radius:22px;background:var(--primary);border-color:var(--primary)}
@media(prefers-reduced-motion:reduce){.module-card:hover{transform:none}}
:root{--tblr-primary:var(--primary);--tblr-primary-rgb:var(--bs-primary-rgb);--tblr-primary-lt:var(--soft);--tblr-body-bg:var(--bg);--tblr-body-color:var(--text);--tblr-bg-surface:var(--surface);--panel:var(--surface)}
.tabler-layout .tw-sidebar .tw-nav-link{font-size:10px;min-height:60px;padding:7px 2px;border-radius:10px;background:transparent;box-shadow:none;color:var(--muted)}
.tabler-layout .tw-sidebar .tw-nav-link:hover{background:var(--hover);color:var(--text)}
.tabler-layout .tw-sidebar .tw-nav-link.active{background:var(--soft);color:var(--accent)}
body button.btn.primary,body button.btn.btn-primary,html[data-theme=dark] button.btn.primary,html[data-theme=dark] button.btn.btn-primary{background:var(--primary);border-color:var(--primary);color:#fff}
body button.btn.primary:hover,body button.btn.btn-primary:hover,html[data-theme=dark] button.btn.primary:hover,html[data-theme=dark] button.btn.btn-primary:hover{background:var(--primary);border-color:var(--primary);color:#fff;filter:brightness(.94);box-shadow:none}
body .table thead th{text-transform:none;letter-spacing:0;background:var(--surface-2);color:var(--muted)}
.wizard .step.active span{background:var(--primary)}

@media(prefers-color-scheme:dark){:root:not([data-theme]){--bg:#181818;--surface:#212121;--hover:#2c2c2c;--surface-2:#2b2b2b;--text:#f5f5f5;--muted:#aaa;--line:#353535;--border:var(--line);--accent:#aa9aff;--primary:#8774e1;--soft:#8774e126;--good:#78d399;--warn:#f0bd6d;--bad:#ff959b;--bs-primary:#8774e1;--bs-primary-rgb:135,116,225;--secretary-in:#212121;--secretary-out:#766ac8;--secretary-chat:#101619;--secretary-pattern:#ffffff07;--secretary-shadow:0 1px 2px #0003}}
.inbox .chat-header .user-profile-trigger,.inbox .chat-header .user-profile-name{border:0;background:transparent;box-shadow:none;padding:0;min-height:0;border-radius:0}
.inbox .chat-header .user-profile-trigger{border-radius:50%}
#telegram-parser-tray{left:calc(var(--tw-sidebar) + 16px)}
@media(max-width:991px){#telegram-parser-tray{left:16px}}

/* Telegram-style one-line reply composer. Tools expand above the input. */
.inbox #send-form.composer{padding:8px 14px;display:block}
.inbox .telegram-compose-line{display:flex;align-items:flex-end;gap:8px;max-width:980px;margin:auto}
.inbox #send-form #reply{flex:1;min-width:0;min-height:40px;max-height:144px;padding:9px 14px;border:1px solid var(--line);border-radius:22px;background:var(--hover);resize:none;line-height:22px;margin:0;overflow-y:auto}
.inbox #send-form .telegram-compose-line>button{width:40px;height:40px;min-width:40px;border-radius:50%;padding:0;font-size:21px;flex-shrink:0}
.inbox .compose-tools{position:relative;flex:0 0 40px;margin:0}
.inbox .compose-tools>summary{display:grid;place-items:center;width:40px;height:40px;border-radius:50%;font-size:27px;cursor:pointer;list-style:none;color:var(--muted)}
.inbox .compose-tools>summary::-webkit-details-marker{display:none}
.inbox .compose-tools-popup{position:absolute;bottom:50px;left:0;width:260px;max-width:calc(100vw - 44px);padding:12px;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 30px #0003;z-index:35;display:flex;flex-direction:column;gap:10px}
.inbox .compose-tools:not([open])>.compose-tools-popup{display:none}
.inbox #send-form #file-note:empty{display:none}
.inbox #send-form #file-note{margin:4px 48px 0;overflow-wrap:anywhere}
.inbox .compose-tools .attachment-control{width:auto;min-height:40px;display:flex;align-items:center;gap:8px;position:relative;overflow:hidden}
.inbox .compose-tools .attachment-control input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%!important}
.inbox [data-dialog-checked]{margin:2px 0 0;font-size:11px}
.inbox #send-form .compose-tools{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;min-height:0}
.inbox #send-form .compose-tools>summary{padding:0;border:0;margin:0;min-height:40px;height:40px;width:40px;background:transparent}

.inbox .dialog-send-blocked{padding:9px 16px;margin:0;background:color-mix(in srgb,var(--bad) 12%,var(--surface));color:var(--bad);font-size:12px;border-bottom:1px solid var(--line)}
.inbox #send-form[aria-disabled=true]{opacity:.55}
.inbox .dialog-stage.danger{color:var(--bad);background:color-mix(in srgb,var(--bad) 15%,var(--surface));border-radius:12px;padding:2px 7px}

/* Secretary's detached input panel: chat wallpaper continues below and around it. */
.inbox #send-form.composer{background:transparent;border:0;padding:8px 16px calc(14px + env(safe-area-inset-bottom,0px));box-shadow:none}
.inbox .telegram-compose-line{max-width:760px;gap:8px}
.inbox .telegram-compose-panel{flex:1;min-width:0;position:relative;background:var(--surface);border-radius:16px 16px 4px 16px;box-shadow:0 2px 6px #0002}
.inbox .telegram-compose-input{display:flex;align-items:flex-end;gap:2px;padding:3px 4px;min-height:54px}
.inbox #send-form #reply{background:transparent;border:0;border-radius:0;box-shadow:none;min-height:44px;padding:11px 6px}
.inbox #send-form .telegram-compose-line>button{width:54px;height:54px;min-width:54px;background:var(--surface);border-color:transparent;color:var(--primary);box-shadow:0 2px 6px #0002}
.inbox #send-form .telegram-compose-line>button:hover{background:var(--primary);color:#fff}
.inbox #send-form .compose-tools>summary{height:44px;min-height:44px}
.inbox #send-form #file-note{margin:0 12px 8px 46px}
@media(max-width:700px){.inbox #send-form.composer{padding:6px 8px calc(10px + env(safe-area-inset-bottom,0px))}}
