/* Portal pages retain their reading width. Running projects use the viewport. */
.sidebar [hidden],#project-shell-actions[hidden],#portal-menu-backdrop[hidden]{display:none!important}
#portal-menu-toggle,#portal-menu-close{display:none}
.topbar .shell-location{display:flex;align-items:center;gap:10px;min-width:0;font-size:12px;color:var(--muted)}
.shell-location>#section-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#project-shell-actions{display:flex;gap:4px;flex-wrap:nowrap}
#project-shell-actions .button{width:36px;height:36px;min-height:36px;padding:8px;border:0;background:transparent;border-radius:10px}
#project-shell-actions .button:hover{background:var(--raised)}
#project-shell-actions .button>span{display:none}
.sidebar nav>#community-nav{display:flex;align-items:center;gap:14px;width:100%;padding:12px 14px;text-align:left;min-height:46px;background:transparent;border-radius:12px;color:var(--muted);opacity:.65}
#community-nav>span{display:grid;gap:1px}#community-nav strong{font:inherit;font-weight:400}#community-nav small{font-size:10px;color:var(--muted)}
.portfolio-catalog .project-card{position:relative;transition:background .15s,box-shadow .15s}
.portfolio-catalog .project-card:has(a.project-info-link):hover,.portfolio-catalog .project-card:focus-within{background:var(--raised)}
.portfolio-catalog .project-card a.project-info-link::after{content:'';position:absolute;inset:0;border-radius:20px}
.portfolio-catalog .project-card:has(a.project-info-link):hover .project-info-link,.portfolio-catalog .project-card:focus-within .project-info-link{color:var(--accent);text-decoration:underline;text-underline-offset:4px}
.portfolio-catalog .project-card a.project-info-link:focus-visible{outline:none}
.portfolio-catalog .project-card a.project-info-link:focus-visible::after{outline:2px solid var(--accent);outline-offset:3px}
body.farmtask-page{--portal-header-height:52px}
body.farmtask-page .workspace{height:100dvh;min-height:0;padding-bottom:0}
body.farmtask-page .topbar{height:var(--portal-header-height);min-height:var(--portal-header-height);padding:6px 16px;gap:10px}
body.farmtask-page #main{max-width:none;margin:0;width:100%;padding:0;flex:1;min-height:0;overflow:hidden}
body.farmtask-page .project-runtime{height:100%;min-height:0;overflow:hidden}
body.farmtask-page .farmtask-workspace{height:100%;min-height:0;max-width:none}
body.project-shell-tools .farmtask-toolbar{display:none}
body.farmtask-page .topbar #portal-menu-toggle{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;flex-shrink:0}
body.farmtask-page .topbar .profile-pill{padding:4px 8px;gap:7px;min-height:36px}
body.farmtask-page .topbar .avatar.small{width:28px;height:28px}
body.farmtask-page .topbar .header-actions{gap:4px}
@media(min-width:680px){
 body.farmtask-page .sidebar{width:72px;padding:14px 10px}
 body.farmtask-page .workspace{margin-left:72px}
 body.farmtask-page .sidebar .brand{padding:0 4px 25px;justify-content:center}
 body.farmtask-page .sidebar .brand>div,body.farmtask-page .sidebar .nav-label,body.farmtask-page .sidebar .sidebar-bottom,body.farmtask-page .sidebar nav>a>span,body.farmtask-page .sidebar #community-nav>span{display:none}
 body.farmtask-page .sidebar nav>a,body.farmtask-page .sidebar nav>#community-nav{padding:12px;justify-content:center;gap:0;min-height:46px}
 body.farmtask-page .sidebar .nav-project-icon{flex-shrink:0}
}
@media(max-width:679px){
 body.farmtask-page{--portal-header-height:44px}
 body.farmtask-page .workspace{height:100dvh;padding-bottom:calc(56px + env(safe-area-inset-bottom));margin-left:0}
 body.farmtask-page .topbar{padding:4px 6px}
 .sidebar{height:calc(56px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom)}
 .sidebar nav,body.signed-out .sidebar nav{height:56px;gap:0;scrollbar-width:none}
 .sidebar nav::-webkit-scrollbar{display:none}
 .sidebar nav>a,.sidebar nav>#community-nav{flex:1 0 auto;min-width:68px;width:auto;height:56px;min-height:0;padding:5px 8px 2px;font-size:9px;line-height:1.2;gap:2px;flex-direction:column;justify-content:center;text-align:center;white-space:nowrap}
 .sidebar nav>a>.icon:first-child{width:20px;height:20px;margin:0 0 3px}
 /* Paint the pill on the icon box itself; no viewport-dependent offset. */
 .sidebar nav>a.active:before{display:none}
 body:not(.portal-menu-open) .sidebar nav>a>:is(.icon,.nav-project-icon):first-child{box-sizing:content-box;width:20px;height:20px;padding:4.5px 16px;margin:0;border-radius:999px;background:transparent;position:relative;z-index:1}
 body:not(.portal-menu-open) .sidebar nav>a.active>:is(.icon,.nav-project-icon):first-child{background:var(--selected)}
 #community-nav .icon{width:20px;height:20px;margin-bottom:2px}#community-nav>span{gap:0}#community-nav small{font-size:8px}
 .workspace{padding-bottom:calc(56px + env(safe-area-inset-bottom))}
 .topbar .shell-location{gap:4px}
 .topbar #portal-menu-toggle{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px}
 .topbar .shell-location>#section-label{max-width:115px;font-size:11px}
 body.farmtask-page .header-actions>.profile-pill>span:not(.avatar),body.farmtask-page .header-actions>.profile-pill>.icon,body.farmtask-page .language-button #language-label{display:none}
 body.farmtask-page .header-actions .icon-button,body.farmtask-page .language-button{width:30px;height:32px;min-height:32px;padding:5px}
 body.farmtask-page .profile-pill{width:32px;padding:2px!important}
 body.farmtask-page .topbar .header-actions{gap:1px}
 #project-shell-actions{gap:0}#project-shell-actions .button{width:30px;height:32px;min-height:32px;padding:5px}
 body.farmtask-page .shell-location{flex:1}
 .topbar .header-actions{min-width:0}
}
#portal-menu-backdrop{position:fixed;inset:0;z-index:20;background:#0007;border:0}
body.portal-menu-open .sidebar{position:fixed;inset:0 auto 0 0;width:min(290px,calc(100vw - 44px));height:100dvh;z-index:30;padding:20px 12px;display:flex;flex-direction:column;align-items:stretch;overflow-y:auto;box-shadow:10px 0 50px #0005}
body.portal-menu-open #portal-menu-close{display:flex;position:absolute;top:10px;right:10px;width:32px;height:32px;align-items:center;justify-content:center}
body.portal-menu-open .sidebar .brand{display:flex;padding:8px 30px 24px 8px;gap:12px;justify-content:flex-start}
body.portal-menu-open .sidebar .brand>div{display:block}
body.portal-menu-open .sidebar .nav-label{display:block}
body.portal-menu-open .sidebar nav{display:flex;flex-direction:column;gap:4px;height:auto;overflow:visible}
body.portal-menu-open .sidebar nav>a,body.portal-menu-open .sidebar nav>#community-nav{display:flex;flex:none;flex-direction:row;align-items:center;justify-content:flex-start;gap:14px;width:100%;height:auto;min-height:46px;padding:11px 14px;font-size:13px;text-align:left;border-radius:12px}
body.portal-menu-open .sidebar nav>a.active{background:var(--selected)!important}
body.portal-menu-open .sidebar nav>a.active:before{display:none}
body.portal-menu-open .sidebar nav>a>span{display:block}
body.portal-menu-open .sidebar nav>a>.icon:first-child{margin:0;width:20px;height:20px}
body.portal-menu-open .sidebar #community-nav>span{display:grid}
body.portal-menu-open .sidebar .sidebar-bottom{display:block;margin-top:auto;padding-top:24px}
@media(prefers-reduced-motion:reduce){.portfolio-catalog .project-card{transition:none}}
/* Short landscape viewports must retain access to the entire desktop rail. */
@media(min-width:680px){
 .sidebar{height:100dvh;min-height:0;overflow-y:auto;overscroll-behavior-y:contain}
 .sidebar>.brand,.sidebar>.nav-label,.sidebar>nav,.sidebar>.sidebar-bottom{flex-shrink:0}
}
body.portal-menu-open .sidebar{min-height:0;overscroll-behavior-y:contain}
body.portal-menu-open .sidebar>.brand,body.portal-menu-open .sidebar>.nav-label,body.portal-menu-open .sidebar>nav,body.portal-menu-open .sidebar>.sidebar-bottom{flex-shrink:0}
