/* The menu follows its project count, up to twelve rows or the available viewport. */
.sidebar{--sidebar-project-row-height:39px;height:auto;min-height:0;max-height:calc(100dvh - 72px);overflow:visible}
.sidebar>.brand-row,.sidebar>.primary-nav,.sidebar>.sidebar-footer{flex:0 0 auto}
.sidebar>.history-block{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;overflow:visible}
.sidebar .history-block>.section-heading{flex:0 0 auto}
.sidebar .history-list{flex:0 1 auto;min-height:0;max-height:calc(var(--sidebar-project-row-height) * 12 + 4px);overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-width:thin;scrollbar-color:#c2c2c2 transparent;padding:2px 4px}
.sidebar .history-list>.history-item{height:var(--sidebar-project-row-height);min-height:var(--sidebar-project-row-height);flex:none;line-height:1.35}
.sidebar .history-empty{margin:0;padding:0 10px 5px}
.sidebar .sidebar-footer{padding-top:13px;margin-top:20px}

/* Account and settings are separate controls on a single footer row. */
.sidebar .profile-row{display:flex;align-items:center;gap:8px;width:100%;min-width:0}
.sidebar .profile-row>.profile{display:flex;align-items:center;gap:10px;flex:1 1 auto;min-width:0;width:auto;margin:0;padding:3px 4px;border:0;border-radius:10px;text-align:left;justify-content:flex-start}
.sidebar .profile-row>.profile:hover{background:var(--surface-subtle)}
.sidebar .profile-row .profile-copy{display:block;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar .profile-row .avatar{width:44px;height:44px;flex:0 0 auto}
.sidebar .profile-settings{display:inline-flex;align-items:center;justify-content:center;flex:0 0 36px;width:36px;height:36px;padding:8px;border-radius:50%;color:var(--muted);border:1px solid transparent}
.sidebar .profile-settings>svg{width:18px;height:18px}
.sidebar .profile-settings:hover{background:var(--surface-subtle);color:var(--ink)}
.sidebar .profile-settings:focus-visible{outline:2px solid var(--focus);outline-offset:3px}
.nav-collapsed .sidebar>.history-block{display:none}
.nav-collapsed .sidebar .sidebar-footer{margin-top:15px;padding-top:13px}
.nav-collapsed .sidebar .profile-row{flex-direction:column;gap:8px}
.nav-collapsed .sidebar .profile-row>.profile{flex:none;justify-content:center;width:48px;min-height:48px;padding:2px;border-radius:50%}
.nav-collapsed .sidebar .profile-row .profile-copy{display:none}
.nav-collapsed .sidebar .profile-settings{flex:none;width:38px;height:38px}

/* Reduce the fixed menu chrome on short desktop windows, reserving room for history. */
@media(min-width:641px) and (max-height:620px){
 .sidebar{padding-top:16px;padding-bottom:16px;max-height:calc(100dvh - 40px)}
 .sidebar>.brand-row{margin-bottom:16px}
 .sidebar .primary-nav{gap:6px}
 .sidebar .nav-item{min-height:44px;padding-block:9px}
 .sidebar>.history-block{margin-top:16px;padding-top:10px}
 .sidebar .sidebar-footer{margin-top:14px;padding-top:10px}
 .nav-collapsed .sidebar{padding-top:15px;padding-bottom:15px}
 .nav-collapsed .sidebar>.brand-row{gap:10px;margin-bottom:12px}
 .nav-collapsed .sidebar .primary-nav{padding-top:10px;gap:4px}
 .nav-collapsed .sidebar .nav-item{height:44px;min-height:44px}
 .nav-collapsed .sidebar .sidebar-footer{margin-top:12px;padding-top:10px}
}
@media(min-width:641px) and (max-height:440px){
 .sidebar{padding-top:12px;padding-bottom:12px;max-height:calc(100dvh - 28px)}
 .sidebar>.brand-row{margin-bottom:10px}
 .sidebar .brand-row .brand-icon{width:30px;height:30px}
 .sidebar .primary-nav{gap:4px}
 .sidebar .nav-item{min-height:38px;padding-block:6px}
 .sidebar>.history-block{margin-top:10px;padding-top:8px}
 .sidebar .sidebar-footer{margin-top:10px;padding-top:8px}
 .sidebar .profile-row .avatar{width:38px;height:38px}
 .nav-collapsed .sidebar>.brand-row{gap:8px}
 .nav-collapsed .sidebar .collapse-button{width:32px;height:32px}
 .nav-collapsed .sidebar .nav-item{height:38px;min-height:38px;width:46px}
 .nav-collapsed .sidebar .profile-row{gap:5px}
 .nav-collapsed .sidebar .profile-row>.profile{width:42px;min-height:42px}
 .nav-collapsed .sidebar .profile-settings{width:34px;height:34px;padding:7px}
}

/* Mobile retains the horizontal menu, with both account and settings available. */
@media(max-width:640px){
 .sidebar,.nav-collapsed .sidebar{left:14px;right:14px;top:14px;transform:none;width:auto;height:auto;max-height:none;border-radius:19px;padding:10px 12px;display:flex;flex-direction:row;align-items:center;gap:10px;box-shadow:0 4px 0 -1px var(--ink)}
 .sidebar>.brand-row,.nav-collapsed .sidebar>.brand-row{display:flex;flex-direction:row;align-items:center;gap:8px;margin:0;flex:none}
 .sidebar .brand-row .brand-icon{width:29px;height:29px}
 .sidebar .brand-name,.nav-collapsed .sidebar .brand-name,.sidebar .collapse-button,.nav-collapsed .sidebar .collapse-button{display:none}
 .sidebar>.primary-nav,.nav-collapsed .sidebar>.primary-nav{display:flex;align-items:center;justify-content:center;flex:1 1 auto;min-width:0;gap:4px;border:0;padding:0}
 .sidebar .nav-item,.nav-collapsed .sidebar .nav-item{display:flex;align-items:center;justify-content:center;gap:7px;width:auto;min-height:38px;height:38px;padding:9px 10px;font-size:11px}
 .sidebar .nav-item>span,.nav-collapsed .sidebar .nav-item>span{display:block;white-space:nowrap}
 .sidebar .nav-item>.nav-arrow{display:none!important}
 .sidebar .nav-item svg{width:16px;height:16px}
 .sidebar>.history-block,.nav-collapsed .sidebar>.history-block{display:none}
 .sidebar>.sidebar-footer,.nav-collapsed .sidebar>.sidebar-footer{flex:none;padding:0;margin:0;border:0}
 .sidebar .profile-row,.nav-collapsed .sidebar .profile-row{display:flex;flex-direction:row;align-items:center;width:auto;gap:4px}
 .sidebar .profile-row>.profile,.nav-collapsed .sidebar .profile-row>.profile{display:flex;flex:none;width:34px;min-height:34px;height:34px;padding:1px;justify-content:center;border:0;border-radius:50%;margin:0}
 .sidebar .profile-row .avatar,.nav-collapsed .sidebar .profile-row .avatar{width:31px;height:31px}
 .sidebar .profile-row .avatar>svg{width:17px;height:17px}
 .sidebar .profile-row .profile-copy,.nav-collapsed .sidebar .profile-row .profile-copy{display:none}
 .sidebar .profile-settings,.nav-collapsed .sidebar .profile-settings{display:inline-flex;flex:none;width:32px;height:34px;padding:7px}
 .sidebar .profile-settings>svg{width:18px;height:18px}
 .sidebar .profile-row [data-tooltip]:after,.nav-collapsed .sidebar .profile-row [data-tooltip]:after{left:auto;right:0;top:calc(100% + 12px);bottom:auto;transform:translateY(-4px)}
 .sidebar .profile-row [data-tooltip]:is(:hover,:focus-visible):after,.nav-collapsed .sidebar .profile-row [data-tooltip]:is(:hover,:focus-visible):after{transform:translateY(0)}
 .workspace,.nav-collapsed .workspace{margin-left:0;padding:95px 22px 35px}
 .authoring .workspace{padding:105px 20px 30px}
 .handoff-expanded .workspace{padding:121px 22px 35px}
 .mobile-history{display:inline-flex;width:28px;height:28px}
 .mobile-history svg{width:16px;height:16px}
}
@media(max-width:480px){
 .sidebar,.nav-collapsed .sidebar{gap:8px;padding:10px}
 .sidebar .nav-item,.nav-collapsed .sidebar .nav-item{width:39px;height:38px;padding:9px 11px;flex:none}
 .sidebar .nav-item>span,.nav-collapsed .sidebar .nav-item>span{display:none}
 .sidebar .profile-row,.nav-collapsed .sidebar .profile-row{gap:2px}
}
