
/* MBS: independent TailAdmin-like chat layout. Persistent messenger scope and actual read watermark badges. */
@media(min-width:1001px){
.desktop-application-content:has(>.app-shell){height:100dvh;min-height:0;padding:24px;background:var(--bg-primary)}
.desktop-application-content>.app-shell{height:calc(100dvh - 48px);min-height:0;grid-template-columns:var(--chat-list-width,390px) minmax(0,1fr) auto;grid-template-rows:76px minmax(0,1fr);gap:0 20px;background:transparent;overflow:visible}
.app-shell>.workspace-messages-header{grid-column:1;grid-row:1;border:1px solid var(--border-secondary);border-bottom:0;border-radius:16px 16px 0 0;padding:20px;background:var(--bg-elevated)}
.app-shell>.sidebar{grid-column:1;grid-row:2;width:auto;min-width:0;border:1px solid var(--border-secondary);border-top:0;border-radius:0 0 16px 16px;background:var(--bg-elevated);overflow:visible}
.app-shell>.conversation{grid-column:2;grid-row:1/-1;width:auto;min-width:0;border:1px solid var(--border-secondary);border-radius:16px;background:var(--bg-elevated);overflow:hidden}}
#message-filters,#message-filters[hidden]{display:block!important;position:relative;flex:0 0 auto;padding:0 0 12px}
#message-filters .provider-switcher{display:flex;gap:6px;padding:4px 16px 8px;overflow-x:auto;scrollbar-width:thin;align-items:center;flex-wrap:wrap}
#message-filters .provider-switcher>button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;min-width:0;padding:7px 10px;border:1px solid var(--border-secondary);border-radius:9px;background:var(--bg-elevated);color:var(--text-muted);font-size:12px;font-weight:500;white-space:nowrap}
#message-filters .provider-switcher>button.active{background:var(--bg-selected);border-color:var(--border-accent);color:var(--accent)}
#message-filters .provider-switcher>button:hover{background:var(--bg-hover)}
#message-filters .provider-switch-label{display:inline;visibility:visible;opacity:1;max-width:none}
#message-filters .provider-icon{width:18px;height:18px;min-width:18px;font-size:18px}
#message-filters .provider-icon>svg{width:18px;height:18px}
#message-filters .provider-profiles-control{margin-left:auto}
#message-filters .profile-picker{position:absolute;left:16px;right:16px;top:100%;z-index:110;max-height:280px;overflow:auto;border:1px solid var(--border-secondary);border-radius:12px;background:var(--bg-elevated);box-shadow:0 12px 28px #10182812}
#message-filters[hidden]~.conversation-tabs{display:none}
.workspace-search-bar{padding:0 16px 12px;background:var(--bg-elevated)}
.workspace-search-bar input{border-radius:9px;min-height:40px;background:var(--bg-elevated);border-color:var(--border-primary)}
.conversation-tabs{padding:0 16px 12px;gap:6px}
.conversation-tabs button{border-radius:8px;font-size:11px}
.chat-list-display-controls{padding:0 16px 8px;border-bottom:1px solid var(--border-secondary);background:var(--bg-elevated)}
.chat-list{padding:12px;scrollbar-width:thin;min-height:0}
.chat-card,.chat-card.waiting,.chat-card.unread,.chat-card.unanswered{border:0!important;border-left:0!important;border-radius:12px;background:transparent!important;box-shadow:none!important;min-height:88px;padding:12px 10px;gap:9px 12px}
.chat-card::before,.chat-card::after{display:none!important}
.chat-card:hover{background:var(--bg-hover)!important}
.chat-card.active{background:var(--bg-selected)!important}
.chat-card .chat-topline>strong{font-weight:600;font-size:var(--chat-list-font,13px);color:var(--text-primary)}
.chat-card .chat-preview{font-size:12px;color:var(--text-muted);line-height:1.55}
.chat-card .chat-preview-row.two-lines .chat-preview{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-card time{font-size:10px;color:var(--text-muted)}
.chat-card .chat-assignee-row{min-height:14px;font-size:10px}
.chat-card .chat-leader-line,.chat-card .chat-leader-button{font-size:10px;color:var(--text-muted)}
.chat-card .personal-unread-badge{position:absolute;right:12px;top:47px;display:grid;place-items:center;min-width:19px;height:19px;padding:0 5px;border-radius:10px;background:var(--accent-solid);color:#fff;font-size:11px;font-weight:600}
.chat-card:has(.personal-unread-badge) .chat-preview-row{padding-right:24px}
.conversation-header{min-height:76px;padding:18px 22px;border-bottom:1px solid var(--border-secondary);background:var(--bg-elevated);box-shadow:none}
.conversation-header h2{font-size:15px;font-weight:600}
.conversation-placeholder{background:var(--bg-elevated);color:var(--text-muted)}
.chat-history-area{background:var(--bg-elevated)}
.messages{padding:24px clamp(20px,3vw,42px);scrollbar-width:thin}
main[data-appearance=personal][data-bg-light=default] .messages{background:#fff!important;background-image:none!important}
:root[data-theme=dark] main[data-appearance=personal][data-bg-dark=default] .messages{background:var(--bg-elevated)!important;background-image:none!important}
.message-row{margin:14px 0}
.message-bubble{box-shadow:none;border:0;padding:12px 15px;line-height:1.6}
main[data-appearance=personal][data-incoming=default] .message-row.in .message-bubble{background:#f2f4f7;color:#24364b;border:0}
main[data-appearance=personal][data-outgoing=default] .message-row.out .message-bubble{background:#0877bd;color:#fff;border:0}
main[data-appearance=personal][data-outgoing=default] .message-row.out .message-meta{color:#d2ebfb}
:root[data-theme=dark] main[data-appearance=personal][data-incoming=default] .message-row.in .message-bubble{background:#26384a;color:#e6f0f8}
.composer{grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;padding:16px 18px;border-top:1px solid var(--border-secondary);background:var(--bg-elevated);box-shadow:none}
.composer-tools{display:flex;flex-direction:row;gap:3px;align-items:center;grid-template-rows:none}
.composer textarea{min-height:44px;border:1px solid var(--border-secondary);border-radius:10px;padding:11px 13px;background:var(--bg-elevated)}
.composer-icon-button{border-radius:9px;width:36px;height:40px;min-width:36px}
.composer-actions{display:flex;align-items:center;gap:5px}
.composer-icon-button.send{background:var(--accent-solid);color:#fff}
@media(max-width:1000px){#message-filters .provider-switcher{flex-wrap:nowrap}.composer{gap:6px;padding:10px}.composer-tools{gap:2px}.composer-icon-button{width:32px;min-width:32px}.messages{padding:16px}}
@media(max-width:760px){.composer{grid-template-columns:auto minmax(0,1fr) auto}.chat-card{min-height:84px}#message-filters .provider-profiles-control{margin-left:0}.conversation-header{padding:12px 14px;min-height:64px}}

/* Template header and compact three-dot filters. */
.desktop-application-content{display:flex;flex-direction:column;height:100dvh;min-height:0;overflow:auto}
.desktop-application-content:has(>.app-shell){padding:0!important}
.desktop-application-content>:not(.mbs-topbar){flex:1;min-height:0}
.mbs-topbar{height:76px;min-height:76px;flex:0 0 76px;padding:0 24px;display:flex;align-items:center;justify-content:space-between;gap:16px;background:var(--bg-elevated);border-bottom:1px solid var(--border-secondary);z-index:140}
.mbs-topbar-left,.mbs-topbar-right{display:flex;align-items:center;gap:12px;min-width:0}
.mbs-topbar-title{font-size:15px;font-weight:500;color:var(--text-secondary)}
.mbs-topbar-icon{display:inline-flex;justify-content:center;align-items:center;width:44px;height:44px;min-width:44px;border:1px solid var(--border-secondary);border-radius:10px;background:var(--bg-elevated);color:var(--text-muted);padding:0;position:relative;cursor:pointer;list-style:none}
.mbs-topbar-icon:hover{background:var(--bg-hover)}
.mbs-topbar summary::-webkit-details-marker{display:none}
.mbs-topbar details{position:relative}
.mbs-topbar summary{list-style:none;cursor:pointer}
.mbs-account-menu>summary{display:flex;align-items:center;gap:10px;min-height:44px;border-radius:10px}
.mbs-account-avatar{width:44px;height:44px;min-width:44px;border-radius:12px;display:grid;place-items:center;background:var(--bg-selected);color:var(--accent);font-size:14px;font-weight:600;position:relative;overflow:hidden}
.mbs-account-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.mbs-account-avatar img[hidden]{display:none}
.mbs-account-name{max-width:200px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:13px;font-weight:600;color:var(--text-primary)}
.mbs-unread-dot{position:absolute;right:0;top:-3px;width:9px;height:9px;background:#fb923c;border:2px solid var(--bg-elevated);border-radius:50%}
.mbs-topbar-popup{position:absolute;top:calc(100% + 12px);right:0;width:250px;max-width:calc(100vw - 24px);padding:10px;background:var(--bg-elevated);border:1px solid var(--border-secondary);border-radius:12px;box-shadow:0 12px 32px #10182812;z-index:300}
.mbs-topbar-popup>strong,.mbs-topbar-popup>p{display:block;padding:8px;font-size:13px;line-height:1.6}
.mbs-topbar-popup>p{color:var(--text-muted);margin:0 0 8px}
.mbs-topbar-popup>button{display:block;width:100%;padding:11px 12px;text-align:left;background:transparent;border:0;border-radius:8px;color:var(--text-primary);font-size:14px}
.mbs-topbar-popup>button:hover{background:var(--bg-hover)}
.mbs-system-notices{display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--border-secondary);padding:12px 8px 4px;gap:12px;font-size:12px;color:var(--text-muted)}
.desktop-navigation-toggle{display:none!important}
@media(min-width:1001px){.desktop-application-content>.app-shell{height:calc(100dvh - 124px);margin:24px;flex:0 0 calc(100dvh - 124px);width:auto}}
.sidebar{position:relative}
#workspace-search,#workspace-search[hidden]{display:block!important}
.message-filters-toggle[aria-controls=workspace-search]{display:none}
.message-filters-toggle[aria-controls=message-filters]{position:relative;border:0;background:transparent;width:32px;height:36px;z-index:132}
.message-filters-toggle[aria-controls=message-filters]>svg{display:none}
.message-filters-toggle[aria-controls=message-filters]::after{content:"⋮";font-size:23px;font-weight:400}
.mbs-filters-backdrop{position:fixed;inset:0;z-index:130;background:transparent;border:0;cursor:default}
#message-filters[hidden]{display:none!important}
#message-filters:not([hidden]){display:block!important}
#message-filters.mbs-filters-popup{position:absolute;right:12px;left:12px;top:0;z-index:133;padding:40px 0 12px;background:var(--bg-elevated);border:1px solid var(--border-secondary);border-radius:12px;box-shadow:0 12px 30px #10182820;max-height:min(620px,75dvh);overflow:auto}
#message-filters.mbs-filters-popup::before{content:"Фильтры чатов";position:absolute;left:16px;top:15px;font-size:13px;font-weight:600;color:var(--text-primary)}
#message-filters .mbs-close-filters{position:absolute;right:8px;top:8px;width:30px;height:30px;background:transparent;border:0;color:var(--text-muted);font-size:20px;border-radius:6px}
#message-filters .conversation-tabs{display:flex;flex-wrap:wrap;padding:12px 16px 0;border-top:1px solid var(--border-secondary);margin-top:8px}
#message-filters .profile-picker{position:static;margin:4px 16px;max-height:200px;box-shadow:none;border-radius:8px}
#message-filters>label,#message-filters>.responsible-filter{margin:8px 16px}
@media(max-width:1000px){.mbs-topbar{height:64px;min-height:64px;flex-basis:64px;padding:0 16px}.desktop-application-content>.app-shell{height:calc(100dvh - 64px);min-height:0;flex:1}.mbs-topbar-title{font-size:13px}.mbs-topbar-left,.mbs-topbar-right{gap:8px}}
@media(max-width:760px){.mbs-account-name,.mbs-topbar-title{display:none}.mbs-topbar{padding:0 12px}.mbs-topbar-right{gap:8px}.mbs-topbar-icon{width:40px;min-width:40px;height:40px}.mbs-account-avatar{width:40px;height:40px;min-width:40px}.mbs-unread-menu .mbs-topbar-popup{right:-60px}.desktop-application-content>.app-shell{height:calc(100dvh - 64px - 64px);flex:1}.mobile-navigation{z-index:110}}

/* White chat list and blue bubbles follow the personal palette settings. */
.app-shell .sidebar .chat-list{background:var(--bg-elevated)}

.mbs-login-theme{position:absolute;top:20px;right:20px;z-index:2;display:flex;align-items:center;justify-content:center;width:44px;height:44px;padding:10px;border:1px solid var(--border-primary);border-radius:12px;background:var(--bg-elevated);color:var(--text-primary);font:inherit;cursor:pointer}.mbs-login-theme:focus-visible{outline:3px solid #4f8cff;outline-offset:3px}.mbs-login-theme svg{width:20px;height:20px}@media(max-width:600px){.auth-screen.auth-landing{padding-top:80px}.mbs-login-theme{top:16px;right:16px}}

.brand-icon{background:none!important;object-fit:contain}.brand-lockup .mbs-brand-logo{display:block;width:auto;height:48px;object-fit:contain}.brand-lockup .mbs-logo-dark{display:none}:root[data-theme=dark] .brand-lockup .mbs-logo-light{display:none}:root[data-theme=dark] .brand-lockup .mbs-logo-dark{display:block}.auth-welcome .brand-lockup .mbs-brand-logo{height:64px}.desktop-navigation-brand .brand-lockup .mbs-brand-logo{height:44px}.brand-lockup.compact .brand-icon{width:44px;height:44px;flex-shrink:0}

.auth-landing .auth-welcome{background:#e4f2ff url("./login-backgrounds/light.png") center bottom/cover no-repeat;justify-content:flex-start;padding:clamp(56px,8vh,88px) 48px 40px}.auth-welcome::before,.auth-welcome::after{content:none}.auth-landing .auth-welcome>.brand-lockup{margin-bottom:28px}.auth-welcome .auth-welcome-note{margin-top:28px}:root[data-theme=dark] .auth-landing .auth-welcome{background:#091d32 url("./login-backgrounds/dark.png") center bottom/cover no-repeat}@media(min-width:1024px) and (max-height:760px){.auth-landing .auth-welcome{padding-top:40px}.auth-landing .auth-welcome>.brand-lockup,.auth-welcome .auth-welcome-note{display:none}.auth-welcome h2{font-size:32px}}

.employee-mode-option.employee-crm-soon:disabled {
  grid-template-columns: auto minmax(0, 1fr);
  cursor: not-allowed;
  opacity: 1;
}
.employee-mode-heading { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.employee-mode-heading h3 { margin: 0; }
.employee-mode-soon { padding: .125rem .5rem; border-radius: 999px; background: var(--bg-selected); color: var(--text-secondary); font-size: .75rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }

.employee-role-select{display:flex;flex-direction:column;gap:8px;color:var(--text-primary);font-size:14px;font-weight:500}.employee-role-select select{min-height:44px;width:100%;padding:10px 12px;background:var(--bg-elevated);color:var(--text-primary);border:1px solid var(--border-primary);border-radius:8px;font:inherit}.employee-role-editor{margin:16px 0}.employee-admin-note{font-size:13px;line-height:1.6;color:var(--text-muted);margin:12px 0}.employee-access-editor.is-admin>fieldset,.employee-access-editor.is-admin>.employee-analytics-access{display:none}
