/* ── APP SHELL: persistent left sidebar ────────────────────────────── */

.app-shell {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.app-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: 200px;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 12px var(--w-pad) 12px 6px;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    background: var(--gray-bg);
    transition: width .2s ease;
}
.app-sidebar::-webkit-scrollbar { display: none; }

.app-sidebar__head:where(.app-sidebar, .app-sidebar *) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 12px 12px;
    min-height: 36px;
}
.app-sidebar__logo-wrap:where(.app-sidebar, .app-sidebar *) {
    display: flex;
    align-items: center;
}
.app-sidebar__logo:where(.app-sidebar, .app-sidebar *), .app-sidebar__logo-ico:where(.app-sidebar, .app-sidebar *) {
    height: 28px;
    display: block;
}
.app-sidebar__logo-ico:where(.app-sidebar, .app-sidebar *) { display: none; }
.app-sidebar__toggle:where(.app-sidebar, .app-sidebar *) {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--gray-border);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    flex-shrink: 0;
}
.app-sidebar__toggle:hover:where(.app-sidebar, .app-sidebar *) { color: var(--text); background: var(--surface); }

.app-main:where(.app-shell, .app-shell *) {
    flex: 1;
    min-width: 0;
    background: var(--gray-bg);
}

/* Collapsed (icon-only) state — desktop only */
@media (min-width: 769px) {
    .app-shell--collapsed .app-sidebar {
        width: 74px;
        cursor: e-resize;
    }
    .app-shell--collapsed .app-sidebar a, .app-shell--collapsed .app-sidebar button { cursor: pointer; }

    .app-shell--collapsed .app-sidebar__logo:where(.app-sidebar, .app-sidebar *), .app-shell--collapsed .app-sidebar .layout_about, .app-shell--collapsed .app-sidebar .sidebar-divider, .app-shell--collapsed .app-sidebar .sidebar-link__label {
        display: none;
    }
    .app-shell--collapsed .app-sidebar__logo-ico:where(.app-sidebar, .app-sidebar *) { display: block; }
    .app-shell--collapsed .app-sidebar__head:where(.app-sidebar, .app-sidebar *) {
        justify-content: center;
        position: relative;
    }
    .app-shell--collapsed .app-sidebar__toggle:where(.app-sidebar, .app-sidebar *) {
        display: none;
        position: absolute;
        inset: 0;
        margin: auto;
        width: 28px;
        height: 28px;
    }
    .app-shell--collapsed .app-sidebar__head:hover .app-sidebar__toggle:where(.app-sidebar, .app-sidebar *) { display: flex; }
    .app-shell--collapsed .app-sidebar__head:hover .app-sidebar__logo-ico:where(.app-sidebar, .app-sidebar *) { visibility: hidden; }
    .app-shell--collapsed .app-sidebar .layout_sidebar-nav .sidebar-link {
        justify-content: center;
        padding: 8px 0;
    }
    .app-shell--collapsed .app-sidebar__toggle svg:where(.app-sidebar, .app-sidebar *) {
        transform: rotate(180deg);
    }
}

/* ── Mobile burger + dropdown sidebar ──────────────────────────────── */
.app-burger:where(.app-shell, .app-shell *, .guest-header, .guest-header *) {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 9px 8px;
    margin-right: 8px;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}
.app-burger span:where(.app-shell, .app-shell *, .guest-header, .guest-header *) {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}
.app-burger span:nth-child(1):where(.app-shell, .app-shell *, .guest-header, .guest-header *) { width: 70%; }
.app-burger span:nth-child(2):where(.app-shell, .app-shell *, .guest-header, .guest-header *) { width: 100%; }
.app-burger span:nth-child(3):where(.app-shell, .app-shell *, .guest-header, .guest-header *) { width: 45%; }

@media (max-width: 768px) {
    .app-burger:where(.app-shell, .app-shell *, .guest-header, .guest-header *) { display: flex; }

    .app-shell { display: block; }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 80vh;
        padding: 60px 16px 20px;
        border-right: none;
        border-bottom: 1px solid var(--gray-border);
        background: var(--surface);
        z-index: 40;
        transform: translateY(-100%);
        transition: transform .25s ease;
        box-shadow: 0 4px 24px var(--shadow-color);
    }
    .app-shell--mobile-open .app-sidebar {
        transform: translateY(0);
    }
    .app-sidebar__toggle:where(.app-sidebar, .app-sidebar *) { display: none; }
    .app-sidebar__head:where(.app-sidebar, .app-sidebar *) { justify-content: flex-start; }
}

:root{--w-pad:20px;--list-width:clamp(300px,22.5vw,450px)}
html:has(.app-shell),body:has(.app-shell){height:100%;overflow:hidden}.workspace.app-shell{height:100dvh;min-height:0;align-items:stretch;overflow:hidden}.main:where(.app-shell, .app-shell *, .guest-header, .guest-header *){height:100%;min-height:0;overflow:hidden;position:relative}.app-sidebar.sidebar{border-right:1px solid var(--border)}.app-sidebar__logo:where(.app-sidebar, .app-sidebar *){width:auto;max-width:125px}.app-sidebar__logo-ico:where(.app-sidebar, .app-sidebar *){width:28px;object-fit:contain}.app-sidebar.sidebar nav{display:block;height:auto;overflow:visible}.app-sidebar.sidebar .nav-item{display:flex;flex-direction:row;align-items:center;width:100%;min-width:0;gap:10px;padding:8px 12px;margin:0;line-height:20px;border-radius:8px;font-size:14px;font-weight:400;color:var(--text)}.app-sidebar.sidebar .nav-item svg{width:20px;height:20px;flex:0 0 20px;stroke-width:1.5;color:var(--text-2)}.app-sidebar.sidebar .nav-item>.sidebar-link__label{font-size:14px;line-height:20px;width:auto;text-align:left;flex:1;min-width:0}.app-sidebar .nav-item b{float:right;margin:0 0 0 5px}.app-sidebar.sidebar .nav-item.active{background:var(--surface-3);font-weight:600}.app-sidebar.sidebar .nav-item:hover{background:var(--surface-2)}.app-sidebar.sidebar .nav-divider{margin:10px 12px}.app-sidebar .sidebar-bottom{margin-top:auto;padding:16px 8px 0}.app-sidebar #connection{font-size:11px;display:block}.app-sidebar #connection::before{width:6px;height:6px}.app-sidebar .profile{gap:8px}.app-sidebar .profile strong{max-width:110px;overflow:hidden;text-overflow:ellipsis;font-size:12px}.mobile-shell-bar:where(.app-shell, .app-shell *, .guest-header, .guest-header *){display:none}
body.conversation-mode .topbar:where(.app-shell, .app-shell *, .guest-header, .guest-header *){display:none}.topbar:where(.app-shell, .app-shell *, .guest-header, .guest-header *){flex-shrink:0}.chat-columns{overflow:hidden;min-width:0}.conversation-list:where(.chat-columns, .chat-columns *, .support-page, .support-page *){width:var(--list-width);min-width:0;height:100%;min-height:0;padding:0;background:var(--surface)}.conversation-list .search:where(.chat-columns, .chat-columns *, .support-page, .support-page *){margin:12px 12px 0}.inbox:where(.chat-columns, .chat-columns *, .support-page, .support-page *){min-height:0;padding:0 6px}.chat-item:where(.chat-columns, .chat-columns *, .support-page, .support-page *){padding:11px 8px;gap:8px}.chat-item .avatar:where(.chat-columns, .chat-columns *, .support-page, .support-page *){width:30px;height:30px;border-radius:10px;font-size:13px}.chat-item .chat-meta:where(.chat-columns, .chat-columns *, .support-page, .support-page *){font-size:9px}.conversation:where(.chat-columns, .chat-columns *, .support-page, .support-page *){min-height:0;min-width:0;overflow:hidden;flex:1;display:flex}.thread:where(.chat-columns, .chat-columns *, .support-page, .support-page *){height:100%;min-height:0;overflow:hidden}.thread-header:where(.chat-columns, .chat-columns *, .support-page, .support-page *){height:64px;min-height:64px;flex-shrink:0;padding:10px 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:12px}.thread-header h2:where(.chat-columns, .chat-columns *, .support-page, .support-page *){font-size:14px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.thread-header>div:where(.chat-columns, .chat-columns *, .support-page, .support-page *){min-width:0}.messages:where(.chat-columns, .chat-columns *, .support-page, .support-page *){min-height:0;overflow-y:auto;overscroll-behavior:contain;scroll-behavior:auto;padding:18px 24px}.thread>.typing:where(.chat-columns, .chat-columns *, .support-page, .support-page *), .thread>.reply:where(.chat-columns, .chat-columns *, .support-page, .support-page *), .thread>.reply-draft:where(.chat-columns, .chat-columns *, .support-page, .support-page *), .thread>.attachment-drafts:where(.chat-columns, .chat-columns *, .support-page, .support-page *), .thread>.composer:where(.chat-columns, .chat-columns *, .support-page, .support-page *), .thread>.composer-hint:where(.chat-columns, .chat-columns *, .support-page, .support-page *){flex-shrink:0}.composer:where(.chat-columns, .chat-columns *, .support-page, .support-page *){flex-shrink:0;margin:0;padding:10px 18px;border-top:1px solid var(--line);background:var(--surface);display:flex;align-items:flex-end;gap:8px}.composer textarea:where(.chat-columns, .chat-columns *, .support-page, .support-page *){resize:none;max-height:130px;min-height:42px;min-width:0;flex:1}.composer-hint:where(.chat-columns, .chat-columns *, .support-page, .support-page *){margin:0;padding:0 18px 8px;background:var(--surface)}.thread .typing:where(.chat-columns, .chat-columns *, .support-page, .support-page *){margin:0;padding:2px 20px;min-height:21px}.welcome:where(.chat-columns, .chat-columns *, .support-page, .support-page *){min-height:0;flex:1}
.support-page{flex:1;min-height:0;padding:0;overflow:hidden}.support-layout:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:grid;grid-template-columns:var(--list-width) minmax(0,1fr);gap:0;margin:0;height:100%;min-height:0;overflow:hidden}.support-sidebar:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){min-height:0;display:flex;flex-direction:column;border-right:1px solid var(--line);overflow:hidden;background:var(--surface)}.support-toolbar:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:flex;flex-direction:column;align-items:stretch;gap:10px;padding:12px}.support-toolbar label:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){min-width:0;font-size:10px;color:var(--text-3)}.support-toolbar select:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *), .support-toolbar input:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){width:100%;min-width:0;margin:4px 0 0;padding:8px;border-radius:7px;font-size:11px}.support-filter-row:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:grid;grid-template-columns:1fr 1fr;gap:7px}.support-list:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){flex:1;min-height:0;max-height:none;overflow:auto;padding:0 6px}.support-item:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){border:0;border-radius:8px;margin:0 0 3px;padding:12px 9px;background:var(--surface)}.support-item strong:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){font-size:12px;display:block;overflow:hidden;text-overflow:ellipsis}.support-item.active:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){background:var(--brand-soft)}#support-error:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){flex-shrink:0;margin:0;padding:0 12px;max-height:90px;overflow:auto}#support-error:empty:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:none}.support-heading:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){flex:1;min-width:0}.support-heading p:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){margin:3px 0 0;font-size:10px;color:var(--text-3)}.support-details-dialog{width:min(540px,calc(100vw - 28px));max-height:85dvh;overflow:auto}.support-details-dialog .row{flex-wrap:wrap}.support-details-dialog .row label{flex:1;min-width:0}.support-details-dialog select{max-width:100%}.support-details-dialog details{margin-top:24px}.support-details-dialog #note-form{display:flex;gap:8px}.support-details-dialog #note-form input{width:100%}
@media(min-width:769px){.app-shell--collapsed .app-sidebar.sidebar{width:74px}.app-shell--collapsed .app-sidebar.sidebar .nav-item{justify-content:center;padding:8px 0}.app-shell--collapsed .app-sidebar .sidebar-bottom, .app-shell--collapsed .app-sidebar .nav-divider{display:none}.app-shell--collapsed .app-sidebar__head:focus-within .app-sidebar__toggle:where(.app-sidebar, .app-sidebar *){display:flex}.app-shell--collapsed .app-sidebar__head:focus-within .app-sidebar__logo-ico:where(.app-sidebar, .app-sidebar *){visibility:hidden}.mobile-only:where(.app-shell, .app-shell *){display:none}}
@media(max-width:768px){:root{--w-pad:10px}.workspace.app-shell{display:flex}.app-sidebar.sidebar{position:fixed;top:0;bottom:auto;left:0;right:0;width:100%;height:auto;max-height:80dvh;padding:60px 16px 20px;z-index:40;background:var(--surface);overflow-y:auto}.app-sidebar.sidebar .sidebar-bottom{display:none}.app-sidebar .nav-divider{display:block}.app-sidebar .nav-item b{display:inline}.app-sidebar__head:where(.app-sidebar, .app-sidebar *){margin-bottom:12px}.app-sidebar__toggle:where(.app-sidebar, .app-sidebar *){display:none!important}.app-sidebar__logo:where(.app-sidebar, .app-sidebar *){display:block!important}.app-sidebar__logo-ico:where(.app-sidebar, .app-sidebar *){display:none!important}.app-sidebar .sidebar-link__label{display:block!important}.mobile-shell-bar:where(.app-shell, .app-shell *, .guest-header, .guest-header *){display:flex;align-items:center;height:48px;min-height:48px;flex-shrink:0;padding:0 12px;background:var(--bg-soft);border-bottom:1px solid var(--border);z-index:45}.mobile-shell-bar strong:where(.app-shell, .app-shell *, .guest-header, .guest-header *){font-size:13px}.mobile-shell-bar .app-burger:where(.app-shell, .app-shell *, .guest-header, .guest-header *){display:flex}.main:where(.app-shell, .app-shell *, .guest-header, .guest-header *){padding-bottom:0}.topbar:where(.app-shell, .app-shell *, .guest-header, .guest-header *){height:64px;min-height:64px;padding:10px 18px}.conversation-list:where(.chat-columns, .chat-columns *, .support-page, .support-page *){width:100%}.chat-columns .conversation{display:none}.chat-open .chat-columns .conversation-list{display:none}.chat-open .chat-columns .conversation{display:flex;width:100%}.support-layout:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:flex}.support-sidebar:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){width:100%;border-right:0}.support-conversation:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:none}.support-open .support-sidebar:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:none}.support-open .support-conversation:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:flex;width:100%}.mobile-only:where(.app-shell, .app-shell *){display:block}.thread-header:where(.chat-columns, .chat-columns *, .support-page, .support-page *){padding:8px 12px;gap:8px;height:60px;min-height:60px}.support-thread-header .avatar:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:none}.messages:where(.chat-columns, .chat-columns *, .support-page, .support-page *){padding:12px}.composer:where(.chat-columns, .chat-columns *, .support-page, .support-page *){padding:8px 12px}.support-toolbar:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){display:grid;grid-template-columns:1fr 1fr}.support-filter-row:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){grid-column:1/-1}.support-list:where(.support-page, .support-page *, .support-details-dialog, .support-details-dialog *){max-height:none}.support-page{padding:0}.sidebar .app-sidebar__head .app-sidebar__logo-wrap:where(.app-sidebar, .app-sidebar *){display:flex}}
@media(prefers-reduced-motion:reduce){.app-sidebar{transition:none}}
/* The composer is separated from messages by one straight line. */
form.composer:where(.chat-columns, .chat-columns *, .support-page, .support-page *){border:0;border-top:1px solid var(--line);border-radius:0;box-shadow:none}
form.composer textarea:where(.chat-columns, .chat-columns *, .support-page, .support-page *), form.composer textarea:focus:where(.chat-columns, .chat-columns *, .support-page, .support-page *){border:0;border-radius:0;box-shadow:none;outline:0;background:transparent}

/* Align thread separators with the text, leaving the avatar column clear. */
.chat-item:where(.chat-columns, .chat-columns *, .support-page, .support-page *){position:relative}
#chat-section .chat-item:not(.thread-list-row):not(:last-child):where(.chat-columns, .chat-columns *, .support-page, .support-page *)::after{content:"";position:absolute;left:46px;right:8px;bottom:-2px;height:1px;background:var(--line);pointer-events:none}

/* Connection status belongs to the profile, with an indicator over its avatar. */
.app-sidebar .sidebar-bottom>a.profile{display:flex;align-items:center;gap:8px;padding:14px 2px 0;color:inherit}
.app-sidebar .profile-avatar{position:relative;display:block;flex:0 0 37px;width:37px;height:37px}
.app-sidebar .profile-connection-dot{position:absolute;right:-1px;bottom:-1px;width:11px;height:11px;border:2px solid var(--bg-soft);border-radius:50%;background:var(--presence-offline);pointer-events:none}
.app-sidebar .profile:has(#connection.online) .profile-connection-dot{background:var(--presence-online)}
.app-sidebar .profile-caption{min-width:0;flex:1}
.app-sidebar .profile #connection{font-size:10px;line-height:1.4;margin-top:3px;color:var(--text-3)}
.app-sidebar .profile #connection::before{content:none}
.loading-rows{width:100%;padding:4px 0}.loading-row:where(.loading-rows, .loading-rows *){display:flex;align-items:center;gap:9px;padding:12px 2px;min-height:64px}.loading-avatar:where(.loading-rows, .loading-rows *){width:37px;height:37px;flex:0 0 37px;border-radius:50%;background:var(--skeleton)}.loading-lines:where(.loading-rows, .loading-rows *){display:flex;flex:1;min-width:0;flex-direction:column;gap:9px}.loading-lines>span:where(.loading-rows, .loading-rows *){display:block;height:9px;border-radius:4px;background:var(--skeleton);width:82%}.loading-lines>span:first-child:where(.loading-rows, .loading-rows *){width:56%;height:11px}.loading-accessible{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.loading-rows .loading-avatar, .loading-rows .loading-lines>span{animation:loading-pulse 1.6s ease-in-out infinite}@keyframes loading-pulse{50%{opacity:.45}}@media(prefers-reduced-motion:reduce){.loading-rows .loading-avatar, .loading-rows .loading-lines>span{animation:none}}

.sidebar-footer:where(.app-sidebar, .app-sidebar *){margin-top:auto}.app-sidebar .sidebar-footer .sidebar-bottom{margin-top:0}
.sidebar-utility-links:where(.app-sidebar, .app-sidebar *){display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;padding:12px 8px 0}
.app-sidebar.sidebar .sidebar-utility-link{display:inline;flex:none;width:auto;min-width:0;margin:0;padding:2px 0;border:0;border-radius:0;background:transparent;color:var(--text-3);font-size:11px;line-height:1.6;font-weight:400;text-align:left;cursor:pointer}
.app-sidebar.sidebar .sidebar-utility-link:hover, .app-sidebar.sidebar .sidebar-utility-link.active{background:transparent;color:var(--text)}
.app-sidebar.sidebar .sidebar-utility-link:disabled{cursor:default;opacity:.55}
@media(min-width:769px){.app-shell--collapsed .sidebar-footer:where(.app-sidebar, .app-sidebar *){display:none}}
@media(max-width:768px){.sidebar-footer:where(.app-sidebar, .app-sidebar *){margin-top:0}.sidebar-utility-links:where(.app-sidebar, .app-sidebar *){padding-top:14px}}

/* Content sections use their own headings on desktop. */
@media (min-width: 769px) {
  .main:has(> :is(#feed-section, #contacts-section, #projects-section, #settings-section):not([hidden])) > .topbar:where(.app-shell, .app-shell *, .guest-header, .guest-header *) {
    display: none;
  }
}
/* Same list width as chats; a width chosen with the divider overrides it. */
.support-page .support-layout{grid-template-columns:var(--list-width-custom,var(--list-width)) minmax(0,1fr)}
@media(max-width:768px){.support-page .support-layout{grid-template-columns:1fr}}

/* Guest mobile menu shares the public landing header. */
@media(max-width:768px){
 .app-shell[data-signed-in=false]{--guest-header-height:calc(64px + env(safe-area-inset-top,0px))}
 .app-shell[data-signed-in=false]>.app-content{padding-top:var(--guest-header-height)}
 .app-shell[data-signed-in=false]>.app-sidebar.sidebar{width:100%;max-width:none;left:0;right:0;top:var(--guest-header-height);bottom:0;height:calc(100dvh - var(--guest-header-height));max-height:none;padding:24px 20px calc(24px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;z-index:79;border:0;background:var(--surface);overflow:auto;overscroll-behavior:contain;transform:translateY(-12px);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .2s,transform .2s,visibility .2s}
 .app-shell[data-signed-in=false].app-shell--mobile-open>.app-sidebar.sidebar{transform:none;opacity:1;visibility:visible;pointer-events:auto}
 .app-shell[data-signed-in=false] .app-sidebar__head{display:none}
 .app-shell[data-signed-in=false] .sidebar-footer{margin-top:auto;padding-top:28px}
 .app-shell[data-signed-in=false] .app-sidebar.sidebar .sidebar-bottom{display:block}
 .app-shell[data-signed-in=false] .app-sidebar.sidebar .nav-item{min-height:48px;font-size:16px}
 body:has(.app-shell[data-signed-in=false].app-shell--mobile-open){overflow:hidden}
 body:has(.app-shell[data-signed-in=false].app-shell--mobile-open)>[data-sensever-widget-host]{visibility:hidden}
}
@media(prefers-reduced-motion:reduce){.app-shell[data-signed-in=false]>.app-sidebar.sidebar{transition:none}}
