/* R41J: remove the unmasked top strip of the existing sticky sidebar label.
   This is a scoped fix to the current one-scroll navigation, not a new sidebar. */
.sidebar .navigation{padding-top:0!important}
.sidebar .navigation>.nav-section:first-child{margin-top:0}
.sidebar .nav-section.recent>.section-label{top:0;position:sticky;z-index:4;background:var(--side,#121315);isolation:isolate}
.sidebar .nav-section.recent>.section-label::before{content:"";position:absolute;inset:-1px -1px 0;z-index:-1;background:var(--side,#121315)}
@media(max-height:520px){.sidebar .nav-section.recent>.section-label{position:static;z-index:auto}}
.r41j-chat-usage{margin:0 5px 6px;text-align:right;color:var(--muted);font-size:11px;line-height:1.45;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.r41j-chat-usage[hidden]{display:none!important}

/* R41K: mount the existing request controls above the composer, outside scroll. */
.r41k-resume-footer:empty{display:none}
.r41k-resume-footer{display:flex;justify-content:flex-end;min-width:0;flex:none}
.r41k-resume-footer .r18-progress-actions{margin:0 0 6px;justify-content:flex-end;gap:6px;flex-wrap:wrap}
.r41k-resume-footer button{min-height:36px;max-width:100%;white-space:normal;line-height:1.35}
.r41k-resume-footer .r18-progress-resume:not([hidden]){background:var(--accent,#dfc29d);color:#17130f;border-color:var(--accent,#dfc29d);font-weight:750}
.r41k-resume-footer .r18-progress-actions[hidden]{display:none!important}

/* R41O: fixed header/project heading and fixed tools/account dock.
   Expanded project conversations, pinned conversations and general chats
   share the single middle scroll region. No moving toolbar in history. */
#sidebar>.brand-row,#sidebar>.sidebar-actions,#sidebar>.r41o-project-heading,#sidebar>.r41o-tool-dock,#sidebar>.sidebar-bottom{flex:0 0 auto!important;min-width:0}
#sidebar>.r41o-project-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 8px;margin:0 3px;border-top:1px solid #353634;background:var(--ux3-side,#121416);font-size:12px;min-height:38px}
#sidebar>.r41o-project-heading #toggle-projects[aria-expanded=true] span{transform:rotate(180deg)}
#sidebar>.navigation{border-top:0!important;padding:0 3px 8px!important;min-height:0!important;flex:1 1 0%!important}
#sidebar>.navigation>#project-section:not(.is-open){display:none}
#sidebar>.navigation>.nav-section.recent>.section-label{background:var(--ux3-side,#121416)}
#sidebar>.navigation>.nav-section.recent>.section-label::before{background:var(--ux3-side,#121416)}
#sidebar>.r41o-tool-dock{position:relative;z-index:8!important;box-sizing:border-box;width:100%;padding:4px 6px 5px!important;border-top:1px solid #353634;margin:0!important;gap:0!important;background:var(--ux3-side,#121416)}
#sidebar>.r41o-tool-dock #sidebar-tools{position:relative!important;display:block!important;width:100%;margin:0!important;padding:0!important;border:0!important;overflow:visible!important}
#sidebar>.r41o-tool-dock #sidebar-tools>.ux3-more-summary{background:#24221d;border-color:#3b3730;min-height:42px!important;margin:0}
#sidebar>.r41o-tool-dock #sidebar-tools>.sidebar-tools-list{position:absolute!important;inset:auto 0 calc(100% + 6px) 0!important;width:auto!important;max-width:100%!important;min-width:0!important;max-height:min(42dvh,300px)!important;min-height:0!important;height:auto!important;overflow-y:auto!important;overflow-x:hidden!important;margin:0!important;padding:6px!important;display:grid!important;gap:3px!important;border:1px solid #4b453d!important;border-radius:12px!important;background:#202122!important;box-shadow:0 8px 28px #0008!important;z-index:12!important;overscroll-behavior:contain!important}
#sidebar>.r41o-tool-dock #sidebar-tools:not([open])>.sidebar-tools-list{display:none!important}
#sidebar>.r41o-tool-dock #sidebar-tools>.sidebar-tools-list>[hidden]{display:none!important}
#sidebar>.sidebar-bottom:has(#account-profile:not([hidden])){max-height:none!important;overflow:visible!important;position:relative;z-index:7}
#sidebar>.sidebar-bottom:has(#account-profile:not([hidden])) #workspace-help-r15[open]>nav{position:absolute;bottom:calc(100% + 5px);left:0;right:0;max-height:min(35dvh,220px);overflow:auto;z-index:9;padding:6px 10px;background:#202122;border:1px solid #4b453d;border-radius:9px}
#sidebar>.sidebar-bottom:has(#account-profile:not([hidden])) #account-menu:not([hidden]){max-height:min(45dvh,260px)}
@media(max-height:620px){
 #sidebar>.brand-row{padding:0 6px 5px!important}
 #sidebar>.sidebar-actions{gap:4px!important;padding:0 5px 5px!important}
 #sidebar>.sidebar-actions .new-chat,#sidebar>.sidebar-actions .search-field{min-height:36px!important}
 #sidebar>.r41o-project-heading{padding-block:0;min-height:32px}
 #sidebar>.r41o-project-heading .section-toggle{min-height:32px!important}
 #sidebar>.r41o-tool-dock #sidebar-tools>.ux3-more-summary{min-height:36px!important;padding:6px 9px}
 #sidebar>.sidebar-bottom:has(#account-profile:not([hidden])){padding:3px 4px!important;gap:2px!important}
 #sidebar>.sidebar-bottom #account-profile{min-height:44px!important;padding:5px 7px!important}
 #sidebar>.sidebar-bottom #workspace-help-r15 summary{min-height:30px;padding:4px 7px}
}

/* R41P: one composer/search row and three direct destinations. */
#sidebar>.sidebar-actions{display:grid!important;grid-template-columns:44px minmax(0,1fr)!important;align-items:center;gap:7px!important;padding:0 5px 8px!important}
#sidebar>.sidebar-actions #new-chat.r41p-compose-icon{width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important;padding:0!important;display:grid!important;place-items:center;justify-content:center;color:var(--ux3-gold,#cba76b)!important}
#sidebar>.sidebar-actions>.search-field{min-width:0;min-height:44px!important;height:44px!important;box-sizing:border-box;gap:6px;padding:6px 9px!important}
#sidebar>.sidebar-actions>.search-field svg{flex:0 0 auto}
#sidebar>.sidebar-actions>.search-field input{min-width:0;font-size:12px!important}
#sidebar>.r41o-tool-dock{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important;padding:6px 5px!important}
#sidebar>.r41o-tool-dock #sidebar-tools{position:static!important;min-width:0}
#sidebar>.r41o-tool-dock .r41p-dock-link{display:flex!important;flex-direction:column;align-items:center;justify-content:center;min-width:0;width:100%;box-sizing:border-box;gap:4px;padding:6px 1px!important;min-height:52px!important;height:52px;text-decoration:none;color:var(--ux3-ivory,#f3efe7)!important;background:#202123;border:1px solid #393b3d!important;border-radius:9px;cursor:pointer;font-size:11px!important;font-weight:650;white-space:nowrap;line-height:1.2}
#sidebar>.r41o-tool-dock .r41p-dock-link svg{color:var(--ux3-gold,#cba76b);flex:none}
#sidebar>.r41o-tool-dock .r41p-dock-link:is(:hover,:focus-visible),#sidebar>.r41o-tool-dock #sidebar-tools[open]>.r41p-dock-link{border-color:#ad8958!important;background:#30291f!important}
#sidebar>.r41o-tool-dock #sidebar-tools>.sidebar-tools-list{inset:auto 5px calc(100% + 4px) 5px!important}
#sidebar #account-menu #workspace-help-r15{width:100%;margin:0}
#sidebar #account-menu #workspace-help-r15 summary{min-height:40px;display:flex;gap:10px;padding:7px 12px;color:inherit}
#sidebar #account-menu #workspace-help-r15[open]>nav{position:static!important;inset:auto!important;max-height:none!important;overflow:visible!important;padding:0 0 4px 15px;background:transparent;border:0;box-shadow:none}
#sidebar #account-menu #workspace-help-r15[open]>nav>a{min-height:32px;padding:6px 10px;font-size:12px}
@media(max-height:620px){#sidebar>.r41o-tool-dock .r41p-dock-link{min-height:44px!important;height:44px;gap:2px;padding:3px 1px!important}#sidebar>.r41o-tool-dock .r41p-dock-link svg{width:17px;height:17px}}
